Trending questions in Java

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
474 views
0 votes
1 answer

How do I implement a HttpURLConnection using a Proxy ?

Since java 1.5 you can also pass ...READ MORE

Dec 10, 2018 in Java by Sushmita
• 6,910 points
9,805 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,320 points
6,916 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,120 points
8,457 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,523 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,090 points
5,700 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,056 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
10,643 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,910 points
13,965 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
1,967 views
0 votes
1 answer

Overriding private or static method in Java

You cannot override a private or static ...READ MORE

Jul 31, 2018 in Java by code.reaper12
• 3,500 points
14,772 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,278 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,312 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,034 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,320 points
4,988 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
14,848 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,120 points

edited Oct 7, 2021 by Sarfaraz 9,232 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,910 points
16,711 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,910 points
8,333 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
798 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
561 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
2,681 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
15,558 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
437 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
1,570 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 449 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
3,959 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,728 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
15,913 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
15,281 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
7,664 views
+1 vote
0 answers

How to install java on linux operating system? [closed]

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

May 16, 2019 in Java by Vicky

closed May 16, 2019 by Vardhan 503 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,443 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
1,380 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,120 points
6,979 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
11,278 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,215 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
10,206 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,320 points
2,928 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,210 points
2,085 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,055 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
6,581 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,090 points
2,660 views
0 votes
2 answers

How to iterate in a HashMap in Java?

Iterating using Iterator. Using Generics: Map<Integer, Integer> map = ...READ MORE

Aug 28, 2019 in Java by Sirajul
• 59,230 points
756 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,389 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
2,772 views
0 votes
3 answers

How does the “final” keyword in Java work?

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

Sep 1, 2019 in Java by DEEPAK KUMAR GUPTA
1,890 views
0 votes
1 answer

Dagger error in Java

What's going on? Have a good look at ...READ MORE

Feb 11, 2019 in Java by developer_1
• 3,320 points
3,436 views