Most voted questions in Java

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,517 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,515 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
501 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,445 views
0 votes
2 answers

How to convert a java string into byte array

Try using String.getBytes(). It returns a byte[] ...READ MORE

Aug 22, 2019 in Java by Sirajul
• 59,230 points
1,175 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
782 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,709 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,563 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,244 views
0 votes
2 answers

Resolving PKIX path building failed Error?

You need to add the certificate for App2 to ...READ MORE

Sep 24, 2018 in Java by Sushmita
• 6,910 points
42,555 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,756 views
0 votes
2 answers

Escape Characters in Java

These are escape characters which are used ...READ MORE

Oct 15, 2018 in Java by Daisy
• 8,120 points
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,359 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
655 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
539 views
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
1,003 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
1,000 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
933 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
692 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,244 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,025 views
0 votes
2 answers

How can we assert, that a certain Exception is thrown in JUnit 4 tests?

@Test(expected = IndexOutOfBoundsException.class) public void testIndexOutOfBoundsException() { ...READ MORE

Dec 10, 2018 in Java by Sushmita
• 6,910 points
1,226 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
796 views
0 votes
2 answers

What is the use of final class in java?

In Java, items with the final modifier cannot be ...READ MORE

Oct 5, 2018 in Java by Daisy
• 8,120 points
1,636 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,984 views
0 votes
2 answers

Can we catch multiple exceptions in the same catch clause in Java?

In Java 6 and before versions, we ...READ MORE

Aug 10, 2018 in Java by sharth
• 3,370 points
1,209 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,131 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
946 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
470 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
465 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
584 views
0 votes
2 answers

How can I Copy files from one directory to another in Java

Java 8 Path sourcepath = Paths.get("C:\\data\\temp\\mydir"); ...READ MORE

Aug 10, 2018 in Java by samarth295
• 2,220 points
4,146 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,855 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,694 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,375 views
0 votes
2 answers

Can the size of dynamic array be changed?

import java.util.List; import java.util.ArrayList; import java.util.Random; public class A ...READ MORE

Aug 31, 2018 in Java by Sushmita
• 6,910 points
991 views
0 votes
3 answers

Is there any goto statement in java?

So they could be used one day ...READ MORE

Oct 15, 2018 in Java by Daisy
• 8,120 points
950 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,429 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,154 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
759 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
749 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,090 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,293 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,185 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
459 views
0 votes
2 answers

How an object array can be converted to string array in java?

System.arraycopy is the most efficient way, but ...READ MORE

Aug 8, 2018 in Java by Sushmita
• 6,910 points
4,808 views
0 votes
2 answers

How to convert a JSON String into Object in Java?

You could probably check out Google's Gson: ...READ MORE

Aug 21, 2019 in Java by Sirajul
• 59,230 points
3,055 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
731 views
0 votes
2 answers

how can we Create instance for generic type in java

private static class SomeContainer<E> { ...READ MORE

Aug 27, 2018 in Java by Sushmita
• 6,910 points
26,075 views