Latest questions in Java

+1 vote
12 answers

Hibernate hbm2ddl.auto possible values and their uses

hibernate.hbm2ddl.auto (e.g. none (default value), create-only, drop, create, create-drop, validate, and update) Setting to perform SchemaManagementTool actions automatically as ...READ MORE

Dec 7, 2018 in Java by Shuvodip
73,838 views
+2 votes
13 answers

Unable to execute jar- file: “no main manifest attribute”

add a jar/manifest/attributes setting like this: apply plugin: ...READ MORE

Nov 27, 2018 in Java by krishti
214,213 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
691 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,241 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,225 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,632 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,983 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,208 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,129 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
582 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,849 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,693 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
947 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
+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,960 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,806 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,053 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,073 views
+2 votes
3 answers

Listing all the subclasses of a specific class in Java

Try with BurningWave core library. Here an ...READ MORE

Dec 29, 2019 in Java by anonymous
• 460 points

edited Jan 9, 2020 by anonymous 13,134 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
529 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
548 views
0 votes
12 answers

Java - sending HTTP parameters via POST method easily

Below are the steps we need to ...READ MORE

Dec 11, 2020 in Java by Rajiv
• 8,910 points
109,365 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,111 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
540 views
0 votes
2 answers

How to convert an int array to string using tostring method in java?

Use java.util.Arrays: String res = Arrays.toString(array); System. ...READ MORE

Aug 16, 2019 in Java by Sirajul
• 59,230 points
2,151 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,665 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
631 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
987 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,427 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
650 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
778 views
0 votes
2 answers

How to initialize multi-dimensional array in java?

a multidimensional array can define an array ...READ MORE

Mar 18, 2019 in Java by monica jesvina
991 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,224 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,250 views