Questions tagged as 'java'

3
answers

Why calling System.gc does not guarantee execution of the garbage collector?

Why does not the developer have full control over the garbage collector ? I understand that the role of GC is to automatically manage memory but why even using some method like System.gc is there no guarantee that the GC will run?   ...
asked by 22.12.2015 / 05:23
2
answers

Why use a generic return?

I was looking at the signature class methods Optional and I did not understand what this <T> means in front of the method return empty() : public static <T> Optional<T> empty() It returns a O...
asked by 26.11.2015 / 22:28
2
answers

Where should exception handling be performed to display to the system user?

What is the best place to handle an exception and send a message to the system user in a desktop application? In the controller, in the view or elsewhere?     
asked by 11.12.2015 / 00:34
3
answers

Does Java have any class to work with command line arguments?

I need to create a Java desktop app, and with this pass several parameters of the type:    java myapp.jar -DB c: \ base.db -user admin -pass admin Is there an easy way to get these parameters? Something like this: public static void...
asked by 13.11.2015 / 18:32
4
answers

Extend x Overwritten, what's the difference?

Researching on Object Oriented concepts, I came across the following comparative, Extend (Inheritance) versus Overwritten. I found the following statement for this comparison: Extend: When we include new attributes, methods in a chil...
asked by 26.09.2015 / 22:55
3
answers

Extend classes with private constructor

Why can not I extend classes with private constructor? Getting the A: classes public class A { private A(){} public static void limao(){} } and B: public class B extends A { private B(){} public static void banana()...
asked by 25.02.2014 / 00:23
1
answer

Why is using String in a switch block more efficient than in an if-else block?

According to Java documentation : / p>    The Java compiler generally generates more efficient bytecode from switch statements that use String objects than from chained if-then-else statements.     
asked by 26.08.2015 / 16:37
2
answers

How to align strings to use in a listview?

In my Android project I need to create a table with a listview but the data always comes misaligned. I put each record in my database at a position in an array of strings so I can use it in listview . The method I use to try to alig...
asked by 27.01.2014 / 18:01
1
answer

What is JNDI technology?

I'm starting studies on enterprise applications, and according to my teacher I'm going to need this java technology and would like to know what JNDI is exactly. If possible I wanted an example of its use.     
asked by 26.11.2015 / 18:44
1
answer

What is the difference between = and = in Java?

Reading a book about the Java language, I came across some operators that I had never seen before. They are: >> , << , >>= , <<= , >>> , <<< , >>>= and...
asked by 27.03.2017 / 01:53