Trending questions in Java

0 votes
2 answers

Maximum size of an Java array

There are actually two limits.  The maximum element ...READ MORE

Aug 20, 2019 in Java by Sirajul
• 59,230 points
5,748 views
0 votes
1 answer

What is Comparable in Java?

As the name itself suggests, Comparable is an interface which defines ...READ MORE

Jul 15, 2019 in Java by Neha
• 6,300 points
888 views
0 votes
1 answer

Replace all 0's with 5 in Java

Take a look at this, hope this ...READ MORE

Mar 6, 2019 in Java by Priyaj
• 58,020 points
6,385 views
0 votes
1 answer

What is Just in time compiler in Java?

The Just-In-Time compiler is one of the integral parts ...READ MORE

Jul 14, 2019 in Java by Frankie
• 9,830 points
760 views
0 votes
1 answer

Multiple return types in Java

No, you don't have two return types.It's ...READ MORE

Feb 8, 2019 in Java by developer_1
• 3,350 points
7,474 views
0 votes
1 answer

How to include jars in classpath using command line?

I have tried the following and it's ...READ MORE

Jan 3, 2019 in Java by Daisy
• 8,140 points
8,915 views
0 votes
1 answer

3DES encryption/decryption in Java

Hey, its just that Base 64 encoding ...READ MORE

Nov 8, 2018 in Java by nirvana
• 3,130 points
11,249 views
0 votes
2 answers

Converting between java.time.LocalDateTime and java.util.Date

Try this: Date in = new Date(); LocalDateTime ldt ...READ MORE

Aug 27, 2019 in Java by Sirajul
• 59,230 points
2,932 views
0 votes
1 answer

Including dependencies in a jar with Maven

You can do this using the maven-assembly-plugin ...READ MORE

Jul 21, 2018 in Java by samarth295
• 2,220 points
15,813 views
+1 vote
1 answer

Can you please explain the difference between string, string buffer and string builder?

String are immutable where as StringBuffer and ...READ MORE

Jul 5, 2019 in Java by Akash
• 160 points
1,356 views
0 votes
2 answers

How to round a double to 2 decimal places?

double value = 200.3456; System.out.printf("Value: %.2f", value); You can ...READ MORE

Dec 11, 2018 in Java by Sushmita
• 6,920 points
14,428 views
0 votes
1 answer

Should a class file always be inside package for importing it in jsp page?

Hey there! It is not necessary for the ...READ MORE

May 24, 2019 in Java by Karan
2,224 views
0 votes
1 answer

Java URL encoding of query string parameters

I would not use URLEncoder. Besides being incorrectly ...READ MORE

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

Converting ISO 8601-compliant String to java.util.Date

Unfortunately, the time zone formats available to SimpleDateFormat (Java ...READ MORE

Nov 27, 2018 in Java by Daisy
• 8,140 points

edited Oct 7, 2021 by Sarfaraz 9,820 views
0 votes
1 answer

How to parse invalid XML in Java ?

That "XML" is worse than invalid – it's not well-formed. An ...READ MORE

Mar 7, 2019 in Java by developer_1
• 3,350 points
5,503 views
0 votes
1 answer

How can I make my output float when my two integers are integer?

Hi Prapti , I got your doubt please check ...READ MORE

Jun 3, 2019 in Java by sampriti
• 1,120 points
1,507 views
0 votes
2 answers

How do I read and convert an InputStream object to string type?

You can also use Java Standard Library ...READ MORE

Jul 17, 2018 in Java by Sushmita
• 6,920 points
17,288 views
0 votes
1 answer

What are the different types of database testing?

The 3 types of Database Testing are Structural ...READ MORE

May 9, 2019 in Java by Frankie
• 9,830 points
2,529 views
0 votes
1 answer

Is there a way to instantiate abstract class ?

No, you are not creating the instance ...READ MORE

Dec 12, 2018 in Java by Sushmita
• 6,920 points
8,718 views
0 votes
2 answers

When to use Static Methods in Java?

A static method has two main purposes: For ...READ MORE

Aug 10, 2018 in Java by samarth295
• 2,220 points
16,122 views
0 votes
2 answers

What is the difference between implements and extends?

Extends : This is used to get attributes ...READ MORE

Aug 3, 2018 in Java by samarth295
• 2,220 points
16,358 views
+1 vote
2 answers

What is coercion in Polymorphism?

Implicit type conversion is called coercion polymorphism. ...READ MORE

Jun 25, 2019 in Java by anonymous
3,070 views
0 votes
2 answers

Reverse an Array in Java

If you want to reverse the array ...READ MORE

Aug 28, 2019 in Java by Sirajul
• 59,230 points
838 views
0 votes
1 answer

How can I compare two integers properly?

Hi Divya, I hope this code snippet will ...READ MORE

May 31, 2019 in Java by sampriti
• 1,120 points
1,032 views
0 votes
2 answers

Why it is not possible to define a static method in a Java interface?

Interfaces are concerned with polymorphism which is ...READ MORE

Aug 27, 2019 in Java by Sirajul
• 59,230 points
2,101 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,920 points
15,465 views
0 votes
1 answer

How to Iterate HashMap?

Hi Shashank. Please try this code I hope ...READ MORE

May 30, 2019 in Java by sampriti
• 1,120 points
848 views
0 votes
1 answer

Remove duplicates from an ArrayList in Java

Here is the function for doing this. // ...READ MORE

Mar 6, 2019 in Java by Heena
4,292 views
0 votes
0 answers

Where i have to put resource package so it's accessible by external jar in eclipse?

Servlet.init() for servlet [JERSEY] threw exception java.lang.ExceptionInInitializerError cause by ...READ MORE

May 29, 2019 in Java by anonymous

edited May 30, 2019 by Omkar 605 views
0 votes
1 answer

How to set Encoding in Java ?

Unfortunately, the file.encoding property has to be specified as ...READ MORE

May 29, 2018 in Java by Rishabh
• 3,620 points
16,282 views
0 votes
1 answer

Which of them among ArrayList, LinkedList, and Vector is most efficient for adding and removing elements from the list?

Of the three, LinkedList is generally going to give ...READ MORE

Dec 3, 2018 in Java by Frankie
• 9,830 points
8,109 views
0 votes
2 answers

How do we convert only the second letter of every word in a string to uppercase ?

The following code will perform your desired ...READ MORE

Aug 29, 2018 in Java by curious
• 560 points
12,088 views
+1 vote
2 answers

How to use try & catch block in Java?

Hey @Jino, Using try catch block for your ...READ MORE

Dec 21, 2018 in Java by Nabarupa
2,062 views
0 votes
1 answer

revalidate() vs repaint() in Java Swing

You need to call repaint() and revalidate() both in order ...READ MORE

Sep 20, 2018 in Java by code.reaper12
• 3,500 points
11,251 views
0 votes
1 answer

Deep copying a 2d array in Java

I guess, for deep copying you will ...READ MORE

Nov 13, 2018 in Java by code.reaper12
• 3,500 points
8,866 views
0 votes
1 answer

Mocking static methods with Mockito

@RunWith(PowerMockRunner.class) @PrepareForTest(DriverManager.class) public class Mocker { ...READ MORE

Dec 12, 2018 in Java by Daisy
• 8,140 points
7,435 views
+1 vote
0 answers

How to install java on linux operating system?

I read good info about java but ...READ MORE

May 16, 2019 in Java by Vicky

reopened Nov 15 by Neelam 680 views
0 votes
1 answer

Access method without creating Object

This is not possible in java. You ...READ MORE

Feb 7, 2019 in Java by Dheeraj
4,671 views
0 votes
2 answers

What is the meaning of purpose of this command: java -jar <some jar file>.jar ?

JAR (Java Archive) file is a package file ...READ MORE

Mar 22, 2019 in Java by Omkar
• 69,220 points
2,685 views
0 votes
1 answer

Start a Standalone Application in Java

You can make this work by calling start(...) directly on a ...READ MORE

Mar 6, 2019 in Java by developer_1
• 3,350 points
3,367 views
0 votes
2 answers

How can we add the local JAR files to the Maven Project in Java?

Firstly I would like to give credit ...READ MORE

Nov 5, 2018 in Java by Sushmita
• 6,920 points
11,902 views
0 votes
1 answer

Configuration metadata in Spring Framework

Configuration metadata can be provided to Spring container in ...READ MORE

Aug 3, 2018 in Java by code.reaper12
• 3,500 points
12,587 views
0 votes
2 answers

Give an example for encryption and decryption in AES using Java

getfullstring: Splashscreen.text >>> READ MORE

May 8, 2019 in Java by anonymous
7,050 views
+1 vote
1 answer

What are the types of memory in JVM?

The different types of Memory in JVM ...READ MORE

Mar 7, 2019 in Java by Priyaj
• 58,020 points
3,094 views
0 votes
2 answers

How to check if a string has only letters

You could probably use Java 8 lambda ...READ MORE

Aug 30, 2019 in Java by Karan
• 19,610 points
3,367 views
0 votes
3 answers

How does the “final” keyword in Java work?

Final is a keyword that is used ...READ MORE

Sep 1, 2019 in Java by DEEPAK KUMAR GUPTA
2,483 views
0 votes
2 answers

Fetch list of in-between dates using Java

java.time Package The new java.time.package in Java 8 incorporates ...READ MORE

Aug 21, 2019 in Java by Sirajul
• 59,230 points
5,857 views
0 votes
1 answer

Interface variable are static and final by default. Why?

Interface variables are static because Java interfaces ...READ MORE

Jul 4, 2018 in Java by Daisy
• 8,140 points
13,557 views