Most answered questions in Java

0 votes
1 answer

Bean Scopes in Java Spring

According to my knowledge, the Spring Framework ...READ MORE

Jul 4, 2018 in Java by geek.erkami
• 2,680 points
1,013 views
0 votes
1 answer

Annotation wiring in Spring

By default, Annotation wiring is not turned ...READ MORE

Jul 4, 2018 in Java by code.reaper12
• 3,500 points
991 views
0 votes
1 answer

Measure time elapsed in Java?

This is also a way to work ...READ MORE

Jul 4, 2018 in Java by scarlett
• 1,290 points
584 views
0 votes
1 answer

Number of lines in a file in Java

I found this an efficient way in counting ...READ MORE

Jul 4, 2018 in Java by scarlett
• 1,290 points
414 views
0 votes
1 answer

Iterating through a Collection, avoiding ConcurrentModificationException when removing in loop

You can either use the iterator directly ...READ MORE

Jul 3, 2018 in Java by Rishabh
• 3,620 points
1,149 views
0 votes
1 answer

Continue Keyword in Java

continue is kind of like goto. Are you familiar ...READ MORE

Jul 3, 2018 in Java by Rishabh
• 3,620 points
370 views
0 votes
1 answer

How to get a platform-dependent new line character in Java?

If you are using Java 1.5 or ...READ MORE

Jul 3, 2018 in Java by Akrati
• 3,190 points
680 views
0 votes
1 answer

Difference between JSF, Servlet and JSP?

Servlet - it's java server side layer. JSP ...READ MORE

Jul 3, 2018 in Java by samarth295
• 2,220 points
1,301 views
0 votes
1 answer

How can we format float to n decimal places ?

You may pass the float value: String.format("%.2f", floatVal); READ MORE

Jul 2, 2018 in Java by sophia
• 1,400 points
1,151 views
0 votes
1 answer

A Java collection of value pairs? (tuples?)

The Pair class is one of those ...READ MORE

Jul 2, 2018 in Java by sharth
• 3,370 points
2,206 views
0 votes
1 answer

How to get the Generic type of class at run time?

public class GenericClass<T> { ...READ MORE

Jul 2, 2018 in Java by Akrati
• 3,190 points
639 views
0 votes
1 answer

ThreadLocal variables usage in Java

public class Test { // ...READ MORE

Jun 30, 2018 in Java by code.reaper12
• 3,500 points
453 views
0 votes
1 answer

No appenders could be found for logger(log4j)?

Just to get you going you have ...READ MORE

Jun 29, 2018 in Java by Akrati
• 3,190 points
8,322 views
+1 vote
1 answer

What is the difference between JavaScript and Java

This quote rightly explains that 2 totally ...READ MORE

Jun 29, 2018 in Java by Daisy
• 8,120 points
587 views
0 votes
1 answer

What are Daemon threads in Java?

A daemon thread is a thread that is doing ...READ MORE

Jun 29, 2018 in Java by Daisy
• 8,120 points
549 views
0 votes
1 answer

How to configure Android SDK for finding JDK

Actual SETUP: OS: Windows 8.1 JDK file: jdk-8u11-windows-x64.exe ADT file: ...READ MORE

Jun 29, 2018 in Java by Rishabh
• 3,620 points
529 views
0 votes
1 answer

DEX decompilation in Java Sourcecode

down voteaccep It's easy Get these tools: 1) dex2jar to translate dex ...READ MORE

Jun 29, 2018 in Java by Rishabh
• 3,620 points
3,746 views
0 votes
1 answer

How to add row in JTable

To create a table: JTable table = new ...READ MORE

Jun 29, 2018 in Java by Akrati
• 960 points
2,720 views
0 votes
1 answer

Calling SOAP web services on Android using JAVA

Android does not provide any sort of ...READ MORE

Jun 28, 2018 in Java by Sushmita
• 6,910 points
2,357 views
0 votes
1 answer

How can we run the .jar file by double clicking on windows 7 (64)?

Use the following method to run the ...READ MORE

Jun 28, 2018 in Java by sharth
• 3,370 points
1,588 views
0 votes
1 answer

How can we use java property files?

You can refer the below code: Properties properties ...READ MORE

Jun 28, 2018 in Java by Akrati
• 960 points
485 views
0 votes
1 answer

What is the use of assert keyword in java?

Java assertion feature allows the developer to ...READ MORE

Jun 28, 2018 in Java by scarlett
• 1,290 points
578 views
0 votes
1 answer

Multiple return statements in Java

Yes, you have guessed it right. Language ...READ MORE

Jun 28, 2018 in Java by geek.erkami
• 2,680 points
1,963 views
0 votes
1 answer

How to convert or cast hashmap to JSON object in Java, and again convert JSON object to JSON string?

You can use: new JSONObject(map); READ MORE

Jun 27, 2018 in Java by Akrati
• 3,190 points
6,589 views
0 votes
1 answer

Examples of GoF Design Patterns in Java's core libraries

Observer pattern throughout whole swing (Observable, Observer) MVC also ...READ MORE

Jun 27, 2018 in Java by developer_1
• 3,320 points
1,598 views
0 votes
1 answer

How can we add local .jar file dependency to build.gradle file?

You can refer the below code if ...READ MORE

Jun 27, 2018 in Java by Akrati
• 960 points
5,060 views
+1 vote
1 answer

Remove objects from an array in Java?

We can use external libraries: org.apache.commons.lang.ArrayUtils.remove(java.lang.Object[] array, int ...READ MORE

Jun 26, 2018 in Java by scarlett
• 1,290 points
986 views
0 votes
1 answer

Why there is the need of getters and setters in java

In Java getters and setters are completely ...READ MORE

Jun 26, 2018 in Java by scarlett
• 1,290 points
1,785 views
0 votes
1 answer

How to prevent java.lang.NumberFormatException in Java?

"N/A" is not integer. It must throw NumberFormatException if you ...READ MORE

Jun 26, 2018 in Java by sharth
• 3,370 points
4,479 views
+1 vote
1 answer

How to tell the Maven to use the latest version of dependency in Java?

If you always want to use the ...READ MORE

Jun 26, 2018 in Java by Sushmita
• 6,910 points
14,753 views
0 votes
1 answer

Working of Progress Bar for a File Download

Once of the ways to achieve is ...READ MORE

Jun 26, 2018 in Java by Rishabh
• 3,620 points
6,008 views
0 votes
1 answer

Can a static reference be made to a non-static method

setLoanItem() isn't a static method, it's an instance ...READ MORE

Jun 26, 2018 in Java by samarth295
• 2,220 points
648 views
0 votes
1 answer

How to get the IP address of the machine using Java?

One approach is to use NetworkInterface.getNetworkInterfaces() to get all ...READ MORE

Jun 25, 2018 in Java by sharth
• 3,370 points
768 views
0 votes
1 answer

Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved

Check the maven repository server is up. Check ...READ MORE

Jun 25, 2018 in Java by Sushmita
• 6,910 points
5,543 views
0 votes
1 answer

Trusting all certificates using HttpClient over HTTPS

Note: Do not implement this in production ...READ MORE

Jun 25, 2018 in Java by Rishabh
• 3,620 points
11,021 views
0 votes
1 answer

How to pass an object from one activity to another on Android

One option could be letting your custom ...READ MORE

Jun 25, 2018 in Java by Rishabh
• 3,620 points
4,669 views
0 votes
1 answer

How to convert s Stack trace to a String?

One can use the given method to ...READ MORE

Jun 25, 2018 in Java by sharth
• 3,370 points
723 views
0 votes
1 answer

Programmatically closing a JFrame

If you want the GUI to behave ...READ MORE

Jun 21, 2018 in Java by Parth
• 4,630 points
1,511 views
0 votes
1 answer

How to perform Java 256 bit AES Password Based Encryption?

/* Derive the key, given password and ...READ MORE

Jun 21, 2018 in Java by Akrati
• 3,190 points
1,511 views
0 votes
1 answer

How can we convert Strings to and from UTF8 byte arrays?

To convert STring to byte[]: String s = ...READ MORE

Jun 21, 2018 in Java by Akrati
• 3,190 points
1,619 views
0 votes
1 answer

What issues should be considered when we are overriding equals and hashCode in Java?

equals() must define an equivalent relation and ...READ MORE

Jun 21, 2018 in Java by Sushmita
• 6,910 points
498 views
0 votes
1 answer

How can we set environment variables from java?

For setting the environment variable, you can ...READ MORE

Jun 21, 2018 in Java by Akrati
• 960 points
3,443 views
0 votes
1 answer

Access restriction on class error

My guess is that you are trying ...READ MORE

Jun 21, 2018 in Java by Rishabh
• 3,620 points
779 views
0 votes
1 answer

What is the use of serialVersionUID ?

The docs for java.io.Serializable are probably about as good ...READ MORE

Jun 21, 2018 in Java by Rishabh
• 3,620 points
1,705 views
0 votes
1 answer

What is the difference between hashset and treeset?

HashSet vs TreeSet: 1- Hashset gives better performance (faster) ...READ MORE

Jun 20, 2018 in Java by Akrati
• 3,190 points
4,559 views
0 votes
1 answer

how to play sound in java?

 The following code will work fine. But I ...READ MORE

Jun 20, 2018 in Java by scarlett
• 1,290 points
1,241 views
0 votes
1 answer

What causes java.lang.reflect.InvocationTargetException

The exception is thrown if InvocationTargetException - if ...READ MORE

Jun 20, 2018 in Java by Rishabh
• 3,620 points
8,751 views
0 votes
1 answer

What is the difference between Polymorphism, Overriding and Overloading?

As far as I know, the main ...READ MORE

Jun 19, 2018 in Java by scarlett
• 1,290 points
11,344 views
0 votes
1 answer

What is the use of StringBuilder in java?

If you use String concatenation in a ...READ MORE

Jun 19, 2018 in Java by Akrati
• 960 points
654 views
0 votes
1 answer

Can we use multiline String in Java?

It is not possible directly to use Multiline ...READ MORE

Jun 19, 2018 in Java by sharth
• 3,370 points
538 views