Most answered questions in Java

0 votes
1 answer

Which Java GUI framework we should refer?

If you are working on Desktop Application, ...READ MORE

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

Remotely debugging JVM using Java command line

In order to use JAVA_OPT you need ...READ MORE

Jun 19, 2018 in Java by 93.lynn
• 1,600 points
993 views
0 votes
1 answer

Default Constructor in Java

Well, none of these is the default ...READ MORE

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

what do you mean by static block in java?

Static block is used for initializing the ...READ MORE

Jun 18, 2018 in Java by scarlett
• 1,290 points
678 views
0 votes
1 answer

does java support operator overloading?

Java doesn't supports operator overloading because it's just a ...READ MORE

Jun 18, 2018 in Java by Akrati
• 960 points
41,218 views
0 votes
1 answer

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK

In your Eclipse IDE, go into Window > Preferences > Java > Installed JREs > ...READ MORE

Jun 18, 2018 in Java by Parth
• 4,630 points
3,019 views
0 votes
1 answer

What do you mean by object serialization ?

To serialize an object means to convert its state ...READ MORE

Jun 14, 2018 in Java by scarlett
• 1,290 points
786 views
0 votes
1 answer

How to read an XML file using XPath in Java?

Import the packages required to work with ...READ MORE

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

Generating an MD5 hash?

The MessageDigest class can provide you with an instance ...READ MORE

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

How to fire and handle HTTP requests

There are 2 options you can go ...READ MORE

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

Why is char[] preferred over a string?

Strings are immutable. That means once you've ...READ MORE

Jun 14, 2018 in Java by scarlett
• 1,290 points
460 views
0 votes
1 answer

Can quotes be added in a java string.how?

In Java, you can escape quotes with \: String ...READ MORE

Jun 14, 2018 in Java by Akrati
• 960 points
457 views
0 votes
1 answer

Serializable interface in Java

Serializable is a marker interface that has ...READ MORE

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

What is the simplest way to read JSON from a URL in java

Read json from url use url.openStream() and read contents ...READ MORE

Jun 13, 2018 in Java by samarth295
• 2,220 points
4,831 views
0 votes
1 answer

What's the difference between SoftReference and WeakReference in Java?

Weak references A weak reference, simply put, is a ...READ MORE

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

Fixing android.os.NetworkOnMainThreadException in Java

Android has some good tips on good ...READ MORE

Jun 12, 2018 in Java by Rishabh
• 3,620 points
5,366 views
0 votes
1 answer

In Java, how to find out the min/max values from array of primitive data types?

import java.util.Arrays; import java.util.Collections; import org.apache.commons.lang.ArrayUtils; public class MinMaxValue { ...READ MORE

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

How can we split a comma separated String in Java?

String str = "..."; // write the ...READ MORE

Jun 12, 2018 in Java by Parth
• 4,630 points
2,146 views
0 votes
1 answer

What is abstract class in java?

A class that is declared with abstract ...READ MORE

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

What is ?: this operator called in java ? how dose it function?

? :  is the Conditional operator and is ...READ MORE

Jun 11, 2018 in Java by sophia
• 1,400 points
742 views
0 votes
1 answer

How to call a method after a delay in Android using Java?

final Handler handler = new Handler(); handler.postDelayed(new Runnable() ...READ MORE

Jun 11, 2018 in Java by Akrati
• 3,190 points
5,079 views
0 votes
1 answer

How to stop the Thread in Java?

Use a flag, which will indicate the ...READ MORE

Jun 11, 2018 in Java by Parth
• 4,630 points
1,285 views
+1 vote
1 answer

How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version

This error means you're trying to load ...READ MORE

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

Is Java “pass-by-reference” or “pass-by-value”?

Think of reference parameters as being aliases ...READ MORE

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

How can one day be added to a date?

One possible solution could be using calendar ...READ MORE

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

How can we upload the files using JSP/ Servlets in Java?

<form action="upload" method="post" enctype="multipart/form-data"> ...READ MORE

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

Java Static nested class

Hi, to understand their usage, you must ...READ MORE

Jun 8, 2018 in Java by v.liyyah
• 1,300 points
526 views
0 votes
1 answer

What are preparedstatements? How do they differ from statements?

Statement is used for static queries like ...READ MORE

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

How can I get the current date and time in UTC or GMT in Java?

This definitely returns UTC time: as String ...READ MORE

Jun 7, 2018 in Java by Rishabh
• 3,620 points
27,086 views
0 votes
1 answer

How to use pairs or 2-tuples in java?

You can refer the following code: public class ...READ MORE

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

How can we import javax.servlet API in Eclipse?

Before installing Eclipse, ensure that you are ...READ MORE

Jun 7, 2018 in Java by Parth
• 4,630 points
2,651 views
0 votes
1 answer

Fixing java.lang.UnsupportedClassVersionError in Java

To fix the exception/ error, you should ...READ MORE

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

Eclipse Oxygen fails to start

I think you need to make some ...READ MORE

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

Behavior of Integer Wrapper class and == operator

Well, this is happening because of the ...READ MORE

Jun 7, 2018 in Java by v.liyyah
• 1,300 points
2,410 views
0 votes
1 answer

How can two strings be concatenated in java?

You can concatenate Strings using the + operator: System.out.println("Your number ...READ MORE

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

How to initialize multi-dimensional array in java?

A multidimensional array in Java is really an array ...READ MORE

Jun 6, 2018 in Java by sophia
• 1,400 points
773 views
0 votes
1 answer

Autowired field pointing NULL in Spring

The field annotated @Autowired is null because ...READ MORE

Jun 6, 2018 in Java by Avi
• 160 points

edited Mar 4, 2022 by Sarfaraz 14,213 views
0 votes
1 answer

Exception coming "android.os.NetworkOnMainThreadException"

This exception is thrown when an application ...READ MORE

Jun 6, 2018 in Java by poorvi
• 160 points
1,243 views
0 votes
1 answer

While using next() or nextfoo() , the upcoming nextLine() is skipped by scanner

That's because the Scanner.nextInt method does not ...READ MORE

Jun 6, 2018 in Java by mitto
• 160 points
2,614 views
0 votes
1 answer

To use JavaMail API for sending mails in Android without using the default/built-in App

ADD 3 jars found in the following ...READ MORE

Jun 6, 2018 in Java by sridhar
• 160 points
1,251 views
0 votes
1 answer

How to kill a thread in Java?

You can use a shared variable as ...READ MORE

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

How can we nicely format a floating number into String by removing unnecessary zeros?

public static String fmt(double d) { if(d ...READ MORE

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

Does a 32-bit byte code work in 64-bit JVM?

Yes, Java bytecode (and source code) is ...READ MORE

Jun 5, 2018 in Java by sophia
• 1,400 points
783 views
0 votes
1 answer

What is Classpath in java?

Classpath is a parameter in the Java virtual machine or ...READ MORE

Jun 5, 2018 in Java by Daisy
• 8,120 points
2,854 views
0 votes
1 answer

using comparator for sorting in java

You've got two problems: 1) You're using Collections.sort (which takes ...READ MORE

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

What is the difference == and equals() in Java?

Both the answers (Syntaxes) are correct. If ...READ MORE

Jun 5, 2018 in Java by Akrati
• 3,190 points
789 views
+1 vote
1 answer

How can we resolve java.lang.OutOfMemoryError in Java?

Work with smaller batches of HashMap Objects ...READ MORE

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

How to clone ArrayList and also clone its contents?

Iterate on the items, and clone them ...READ MORE

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

How to resolve the java.net.ConnectException in Java?

If you are getting java.net.ConnectionException, it means ...READ MORE

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

How can we remove html tags from a string?

You can use HTML parser. This is ...READ MORE

Jun 4, 2018 in Java by sophia
• 1,400 points
3,609 views