Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems. Java is currently owned by Oracle, which purchased Sun in 2010.

learn more… | top users | synonyms

12
votes
4answers
4k views

Is a lambda expression something more than an anonymous inner class with a single method?

There is a new hype with the long awaited lambda expressions in Java 8; every 3 day another article appears with them about how cool they are. As far as I have understood they a lambda expression is ...
0
votes
1answer
4k views

How do you write scalable Java? [duplicate]

I like to think I write good maintainable Java code, using best practices, design patterns and try and get good test coverage with unit tests. Recently whilst looking for a job, I came across a ...
7
votes
4answers
1k views

Why does Scala use the '_' operator for package import instead of '*' as in Java?

In my opinion, one of the greatest things about Scala is its interoperability with Java and its similar syntax. One thing that I found strange is the use of the _ operator for package wilcard imports ...
1
vote
1answer
491 views

High performance and/or real time java open source applications [closed]

Which open source java projects do you know to be high performance or real time performance? I tried hard to find them on github or google, but couldn't find suitable. I want to learn from this ...
3
votes
1answer
226 views

How to comply with the Java ASM License?

I am designing an open source Java library that I will likely release with an MIT license, and its sole dependency is the ASM dynamic bytecode injection library. According to their license: ...
0
votes
1answer
2k views

Android game loop in separate thread

I am about to port a game that was initially written for iOs and I am having some doubts how certain things should be done. I have been looking many of the examples of the game loops for android, and ...
8
votes
4answers
1k views

Spring - Confusion over configuration?

Somewhere I read Spring offers convenience over configuration. But Spring folks are bringing in so much changes over the configuration , that I am now really getting confused to use the xml ...
4
votes
2answers
407 views

A design decision in composition or aggregation

I've recently had doubts about some design decisions that I frequently make, so this time I decided to take some time and try to analyze it to find the best solution. I will describe a simple scenario ...
2
votes
2answers
375 views

Writing OOPS code in Non Object Oriented Language

I was reading some article on the internet as I was preparing for interview and I found out below statement- Writing object oriented code, even in non-object oriented language? Is this statement ...
0
votes
1answer
1k views

Why it is not possible to Instantiating Types with Wildcards in Java

I am trying to instantiate LinkedList<?> op = new LinkedList<?>(); But I get error Cannot instantiate the type LinkedList<?> Why is it that this cannot be instantiated in Java? ...
1
vote
1answer
395 views

Why Object.clone() is able to “see” fields defined in subclasses?

I was wandering how can Object.Clone() access field fields that are actually defined in the subclasses, and not the actual implementation of this feature. What is bothering me is that I cannot see ...
-2
votes
2answers
274 views

About Artificial Intelligence [closed]

I am interested in starting a career in artificial intelligence. Can anyone suggest how I could prepare for this? What languages should I study that would be best for this career choice?
-1
votes
1answer
207 views

Banking Applications need Auto save? [closed]

We are developing a banking application. It's internal project of the bank. The application has to capture huge data to process. So auto save is recommended approach to capture? How to perform ...
2
votes
1answer
335 views

Which programming guidelines for a chess network application?

I'd like to implement a simple chess peer to peer network application : one instance of the program may register friends player, and when one friend is "connected" (I mean both available by another ...
3
votes
2answers
298 views

java classes and database queries

Can someone please explain the best way to solve this problem. Suppose I have three classes Person Venue Vehicle I have a DAO method that needs to return some or all of these attributes from each ...
3
votes
2answers
951 views

Tricky compareTo, inheritance, easy to extend - Java

Let's say we have 4 classes A, B, C, D where: A is a superclass of both B and C and C is a superclass of D. I suppose, in a diagram, it should look like this: A / \ B C \ D ...
41
votes
6answers
6k views

Why didn't == operator string value comparison make it to Java?

Every competent Java programmer knows that you need to use String.equals() to compare a string, rather than == because == checks for reference equality. When I'm dealing with strings, most of the ...
14
votes
1answer
37k views

Summary of differences between Java versions?

What are the major differences in between Java version in terms of software development? Where can one find a summary of the most important changes related to programming? The Release Notes such as ...
2
votes
1answer
246 views

Criteria for selecting MigLayout for GUI code?

It seems to be easier to use and more feature rich than standard swing layouts. It looks like a do it all replacement for all standard layouts. If you are making simple code to just show the time in a ...
2
votes
2answers
222 views

What should be in my model and what should be in my controler?

We are writing a system with a sort of quasi-MVC structure (it was never stated as that, but that's what it is). I'm building up a full knowledge of the system and the controller will have to make ...
7
votes
2answers
3k views

Is it a bad habit to (over)use reflection?

Is it a good practice to use reflection if greatly reduces the quantity of boilerplate code? Basically there is a trade-off between performance and maybe readability on one side and ...
0
votes
2answers
348 views

Communication between View and Model

I have a basic issue with the MVC architecture. I am aware that the View usually listens to the Model. But how are user requests propagated to the Model? Currently I do it like this, when the user ...
0
votes
3answers
561 views

Multiple threads and single output source

For the sake of an exercise, say you have an input file with a series of lines of text with the objective of reversing their respective character sequences. Now introduce 5 threads that will each do ...
2
votes
1answer
180 views

Can a strategy be implemented as a nested member class?

Is it okay to have a strategy implemented as a non-static inner class or is it considered a bad practice? public class SomeClass{ private final Strategy strategy; public void someMethod(){ ...
4
votes
4answers
5k views

Is using “out” or “ref” parameters in Java methods to return extra values bad?

I happened to create a mutable class like this: class Mutable<T> { private T value; public Mutable() { this.value = null; } public Mutable(T value) { this.value = value; } T ...
2
votes
1answer
516 views

Best way to lazy load blob from database in Java?

I have a database table that stores uploaded files (excel files) in a blob field. Each record contains the uploader, upload-time, the upload ID (primary key) and of-course, the blob itself. At some ...
3
votes
6answers
788 views

In Java, would you sacrifice type safety for a nicer programming interface

When and why would you generally sacrifice typesafety for a nicer programming interface? Let me give you an example: if you had the choice between two event aggregators, which one would you prefer ...
2
votes
1answer
147 views

Is there a design pattern or technique in Coldufsion/Java for serializing objects differently depending on customer's desires?

I have data available in the form of Structs and Arrays. I need some design pattern advice, which I can use to model this situation into corresponding Coldfusion Components. Here is the data ...
3
votes
2answers
782 views

Programming methodology - best way to level up? [closed]

Ok, so I'm at a point where I think I have my basics down. I'd like to think I'm just starting to become an intermediate dev. So, how do I level up here? It feels like I have reached my threshold, ...
5
votes
2answers
236 views

method to allow me ability to freely modify my classes, but make them immutable to others?

I am creating the model part of an MVC architecture. My one class will provide all the accesses to allow one to fetch system state. I want most of this state to be immutable as it shouldn't be ...
0
votes
3answers
1k views

Can one can survive in the IT industry without knowledge of C and C++? [duplicate]

I am just a graduate from India and I have knowledge of Java, JSP and Servlets, Android application development and some iOS development. I do not have a background in C or C++ and a little weak ...
0
votes
2answers
1k views

Migrating web app from php to Java [closed]

Hi I had today my first interview for a position of android developer.In my portfolio I had a php e-commerce application that has a catalog , ajax powered shopping cart , and administrator ...
1
vote
1answer
2k views

Exception Handling in Java web application

I know exception handling is a topic often discussed in the world of Java. I've read a few threads on here and SO as well. ...
1
vote
1answer
2k views

How can I access my Handler/runnable class from all my other classes in Android?

I am trying to create a class which allows me to do something every 5 seconds and I want to be able to start and stop this from running from any of the other classes. Here is my Timer class: public ...
2
votes
1answer
704 views

JUnitEE vs JUnit

I know what unit testing is in general and what JUnit is in particular. But here I see that there is a project called JUnitEE which seems to me to be a wrapper over JUnit. So I would like to better ...
1
vote
1answer
302 views

Developing a cross-platform interface for writing to hardware like PicKit OR USB over the web?

I thought long and hard on weather to put this question in programmers or stack overflow. Please let me know if this is not the right place and I will post it to SO. My friend and I am developing a ...
1
vote
2answers
413 views

Wrapping specific checked exception in domain unchecked ones? [duplicate]

Uncle Bob says in Clean Code book that Unchecked Exceptions should be used. Now JDK has some checked exceptions: IOException, IllegalAccessException etc. which cannot be avoided. In my application ...
20
votes
2answers
3k views

Why is Java boolean primitive type name not 'bool'?

Java has int and Integer boolean and Boolean This seems a bit inconsistent, why not either bool vs Boolean to use an established shorter name for primitive type? or integer vs Integer to ...
3
votes
0answers
441 views

Fluent interface implementation and reflection. Case study

I hope I picked the right group for this question... I have this little framework I want to implement and I would like to have an opinion on it. In particular I am more concerned about the ...
2
votes
2answers
1k views

How to use MVC in practice

I'm very confused. I can't even begin to understand how MVC would be implemented outside of web development. This might seem like too general a question, but how would one apply MVC. I have the ...
5
votes
5answers
17k views

Java serialization - advantages and disadvantages, use or avoid?

Serialization is used for persistence in Java. It may be okay to persist a few objects using serialization. But, for a large number of objects, ORM, Database etc might be better. It seems that ...
-2
votes
1answer
459 views

Advanced Java Articles [closed]

Recently, I've really been getting into programming. I've always loved it, but now it's all I think about. 24 hours a day, 7 days a week. And now that I'm working a lot and about to graduate and get a ...
1
vote
2answers
100 views

Copyright/General Law for Publishing Online Software

I'm planning on releasing a program I made, but I'm not sure exactly how to ensure people don't just steal it. The price point is $1, but I'm not selling it through an "app store" or anything so I ...
8
votes
3answers
486 views

Programming style in Perl

I work in Java so basically I use OOP paradigm during coding. I am about to start working in Perl and I was wondering what is the paradigm that Perl developers follow. In wiki it mentions that it ...
18
votes
4answers
3k views

Using public final rather than private getters

I see most immutable POJOs written like this: public class MyObject { private final String foo; private final int bar; public MyObject(String foo, int bar) { this.foo = foo; ...
0
votes
2answers
8k views

What is the maximum value of index of an ArrayList?

I was thinking about it. You may have access to endless memory (one computer with lot of RAM) so that you can keep on adding more and more elements to your ArrayList. But, I think that you can only ...
7
votes
2answers
2k views

Why Java does not support private/protected inheritance like C++? [closed]

While inheriting a class in C++, user can specify the access specifier like, class Base { public int mem1; protected in mem2; }; class Derived1 : **private** Base { // mem1 will be ...
13
votes
3answers
3k views

Joda Time vs Java Time

Although Joda is feature rich and more sophisticated than standard Java time, it may not always be the best thing to use. How do I decide if I should use Joda Time or Java Time in any Java code? Is ...
1
vote
1answer
107 views

Make the lines hide (logically speaking) in applets

I am developing an application where I draw large number of lines (color is given as black) and update them where I need to remove them from screen. I thought of making their color to match with the ...
-4
votes
1answer
2k views

Singleton: Is Singleton an Anti-Pattern [duplicate]

Was reading an interesting blog post on Singleton design pattern which is so widely used. If it's stupid or as in some quora posts, its an anti-pattern why is it so widely used even in frameworks. ...