Trending questions in Java

0 votes
1 answer

How to create database in MySql using Java?

First, you will have to create connection ...READ MORE

Aug 27, 2019 in Java by Juni
833 views
0 votes
1 answer

@Component vs @Controller vs @Repository vs @Service annotations in Spring Framework

@Component: This marks a java class as a bean. ...READ MORE

Nov 28, 2018 in Java by code.reaper12
• 3,500 points
12,573 views
0 votes
2 answers

Java Security: Illegal key size or default parameters

Starting from Java 9 or 8u151, you ...READ MORE

Aug 23, 2018 in Java by Parth
• 4,640 points
8,788 views
0 votes
1 answer

How to create password field in Swing?

Swing provides an object called JPasswordField for ...READ MORE

Aug 27, 2019 in Java by Bruce
698 views
0 votes
2 answers

How to return multiple objects from a Java method?

In the event the method you're calling ...READ MORE

Aug 30, 2019 in Java by Karan
• 19,610 points
9,438 views
0 votes
1 answer

which maven dependency has to be added for MongoPreparedStatement in java 1.8

You need to define the dependency of a ...READ MORE

Jul 30, 2019 in Java by Sirajul
• 59,230 points
1,794 views
0 votes
1 answer

How to download Eclipse on a flash drive and use it on a public computer?

To use Eclipse from a flash drive, ...READ MORE

Apr 22, 2019 in Java by Omkar
• 69,220 points
6,020 views
0 votes
2 answers

What is a StackOverflow Error

stackoverflow error – StackOverflow Error in Java. This error is thrown to ...READ MORE

Aug 29, 2020 in Java by Pistle
• 1,000 points
2,353 views
0 votes
1 answer

Can you explain what is the difference between hashtable and hashmap?

Hi, Hashtable is synchronized, whereas HashMap is not. This makes HashMap better for ...READ MORE

Aug 15, 2019 in Java by anonymous
859 views
0 votes
0 answers

Sending request using json object return 404 error code

I am getting mad with this code ...READ MORE

Jun 19, 2019 in Java by FooBayo
• 120 points

edited Jun 19, 2019 by FooBayo 3,074 views
0 votes
1 answer

How can I change my string into date directly?

Hi Priya, You check this code, import java.util.Date; import java.text.DateFormat; import ...READ MORE

Aug 10, 2019 in Java by sampriti
• 1,120 points
754 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,920 points
11,041 views
0 votes
1 answer

Can Enum implement Class

Enum is a type similar to that ...READ MORE

May 27, 2019 in Java by Sirajul
• 59,230 points
3,672 views
+1 vote
0 answers

Initially autowired object has value,it becomes null after paging(using JSF 2.2 and spring 4.01.)

i'm trying to create basic crud operations ...READ MORE

Jul 5, 2019 in Java by swats
1,725 views
0 votes
1 answer

What do you mean by Socket Programming?

Socket programming is a way of connecting two ...READ MORE

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

i am getting sessionnotcreatedexception in appium

Hi... it says here that Appium cannot ...READ MORE

Jun 27, 2019 in Java by ajs3033
• 7,300 points
2,049 views
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,836 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
1,011 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,641 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,509 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
840 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,449 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
9,028 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
3,078 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
16,071 views
0 votes
3 answers

How to rotate an array from a particular index?

private static void rotate(int[] arr, int order) ...READ MORE

Aug 29, 2019 in Java by Sirajul
• 59,230 points
2,230 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,429 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,530 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,781 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 10,019 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,302 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,630 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,470 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,570 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,847 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,715 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,306 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,205 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
968 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,092 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,680 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,237 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
951 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,456 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,326 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,556 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,263 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,383 views