Most voted questions in Java

+1 vote
4 answers

What is the difference between string object and string literal?

A String literal is a Java language concept. This ...READ MORE

Aug 16, 2019 in Java by Sirajul
• 59,230 points
65,025 views
+1 vote
7 answers

What is difference between access modifier and access specifier in java

Access Specifier:- This can be understood as ...READ MORE

Feb 14, 2019 in Java by Priyaj
• 58,090 points
67,956 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,686 views
+1 vote
1 answer

How can I find memory usage of my application in Android?

You can get memory info programmatically and ...READ MORE

Jan 10, 2019 in Java by Sushmita
• 6,910 points
3,458 views
+1 vote
2 answers

What is an Object?

Hey @preetiagarwal, your description is an answer ...READ MORE

Dec 24, 2018 in Java by Priyaj
• 58,090 points
979 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,397 views
+1 vote
2 answers

Factorial of a number using while loop

import java.util.*; public class Fact { ...READ MORE

Mar 19, 2020 in Java by leela
• 140 points
3,904 views
+1 vote
1 answer

How to find even or odd using call by value?

Call by value is, when a primitive ...READ MORE

Nov 23, 2018 in Java by Namitha
1,223 views
+1 vote
1 answer

How to print factorial of a number using While loop?

While also works like for just you ...READ MORE

Nov 22, 2018 in Java by Namitha
1,128 views
+1 vote
1 answer

What are REST clients for Java?

These are the few options : Apache CXF has ...READ MORE

Nov 22, 2018 in Java by Frankie
• 9,830 points
1,933 views
+1 vote
3 answers

3 dot in parameter in Java

The "Three Dots" in java is called ...READ MORE

Nov 22, 2018 in Java by geek.erkami
• 2,680 points
53,507 views
+1 vote
1 answer

Error: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2

Hello @Jino, It is just a JVM bug ...READ MORE

Nov 21, 2018 in Java by Nabarupa
4,417 views
+1 vote
1 answer

Maximum memory usage for JVM

I guess, you can try using the ...READ MORE

Nov 14, 2018 in Java by 93.lynn
• 1,600 points
1,424 views
+1 vote
1 answer

How do I do a HTTP GET?

If you don't want to use external ...READ MORE

Aug 28, 2018 in Java by Neha
• 6,300 points
435 views
+1 vote
4 answers

What is a simple way to repeat a string in java?

There is already answer wriiten using StringBuilder ...READ MORE

Dec 16, 2020 in Java by Rajiv
• 8,910 points
28,596 views
+1 vote
1 answer

How to calculate days between two dates?

You are making some conversions with your ...READ MORE

Aug 28, 2018 in Java by Frankie
• 9,830 points
2,606 views
+1 vote
1 answer

Setting selected item of Spinner by value rather than by position

Suppose your Spinner is named newSpinner, and it contains ...READ MORE

Aug 10, 2018 in Java by 93.lynn
• 1,600 points
21,076 views
+1 vote
1 answer

Convert CSV to JSON. JSON payload should be included in square brackets

The JSON payload uses a list and ...READ MORE

Aug 7, 2018 in Java by Omkar
• 69,210 points
9,244 views
+1 vote
1 answer

Performance difference of if/else vs switch statement in Java

The thing you are worried about is ...READ MORE

Jul 26, 2018 in Java by geek.erkami
• 2,680 points
3,376 views
+1 vote
2 answers

Retrieve all the implementations of an interface in Java

Take a look to this example: https://github.com/burningwave/co ...READ MORE

Dec 21, 2019 in Java by Roberto
• 460 points

edited Jul 7, 2020 by Roberto 36,689 views
+1 vote
1 answer

Converting a date string to a DateTime object using Joda Time library

Use DateTimeFormat: DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss"); DateTime dt = ...READ MORE

Jul 24, 2018 in Java by scarlett
• 1,290 points
4,457 views
+1 vote
1 answer

What is the difference between JavaScript and Java

This quote rightly explains that 2 totally ...READ MORE

Jun 29, 2018 in Java by Daisy
• 8,120 points
581 views
+1 vote
12 answers

Iterate over a JSONObject?

Assuming your JSON object is saved in ...READ MORE

Dec 11, 2020 in Java by Rajiv
• 8,910 points
122,301 views
+1 vote
1 answer

Remove objects from an array in Java?

We can use external libraries: org.apache.commons.lang.ArrayUtils.remove(java.lang.Object[] array, int ...READ MORE

Jun 26, 2018 in Java by scarlett
• 1,290 points
981 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,739 views
+1 vote
2 answers

Is there a code to find 64-bit JVM or 32-bit JVM (from within a program)?

Do I need to understand the difference ...READ MORE

Jun 11, 2019 in Java by Jim
• 810 points
2,028 views
+1 vote
10 answers

How to make mock to void methods with mockito

You can use partial mocking to serve ...READ MORE

Dec 7, 2018 in Java by nitesh
34,319 views
+1 vote
13 answers

How does java.net.SocketException: Connection reset happen ?

You can use wireshark to view the ...READ MORE

Dec 7, 2018 in Java by tushh
249,198 views
+1 vote
2 answers

Calculating date/time difference in Java

We can also use java.util.concurrent.TimeUnit class. long diff = d2.getTime() ...READ MORE

Aug 28, 2018 in Java by Sushmita
• 6,910 points
23,556 views
+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,699 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,948 views
+1 vote
1 answer

How can we resolve java.lang.OutOfMemoryError in Java?

Work with smaller batches of HashMap Objects ...READ MORE

Jun 5, 2018 in Java by sharth
• 3,370 points
828 views
+1 vote
2 answers

Can I convert my Java program to an .exe file?

Launch4j is a cross-platform tool for wrapping ...READ MORE

Oct 18, 2018 in Java by Sushmita
• 6,910 points
3,415 views
+1 vote
1 answer

What if several ports required by tomacat server at local host are already in use

You've another instance of Tomcat already running. ...READ MORE

May 31, 2018 in Java by Akrati
• 3,190 points
5,743 views
+1 vote
13 answers

How to send HTTP POST requests on Java?

With Apache HttpClient In the old days, this Apache ...READ MORE

Dec 10, 2020 in Java by Rajiv
• 8,910 points
157,423 views
+1 vote
2 answers

Non-static variable cannot be referenced from a static context. Explain?

class Program { int count ...READ MORE

Sep 28, 2019 in Java by anonymous
13,661 views
+1 vote
1 answer

Are arrays equivalent to objects in Java ?

Yes; the Java Language Specification writes: In the Java ...READ MORE

May 10, 2018 in Java by Rishabh
• 3,620 points
1,035 views
+1 vote
3 answers

How to convert a List to an Array in Java?

Either: Foo[] array = list.toArray(new Foo[list.size()]); or: Foo[] array = ...READ MORE

Aug 7, 2018 in Java by Akrati
• 3,190 points
885 views
+1 vote
3 answers

Copy Java Array and make a duplicate of it

int[] a = {1,2,3,4,5}; int[] b = Arrays.copyOf(a, ...READ MORE

Aug 30, 2018 in Java by Sushmita
• 6,910 points
1,381 views
+1 vote
2 answers

What are inner classes and static nested classes?

Nested classes are divided into two categories: ...READ MORE

Dec 3, 2018 in Java by Sushmita
• 6,910 points
3,639 views
+1 vote
1 answer

concat() vs “+” operator : In Java for String concatenation

Basically, there are two important differences between ...READ MORE

Apr 27, 2018 in Java by Rishabh
• 3,620 points
4,469 views
+1 vote
2 answers

How to generate random integers within specific range in Java?

You can achieve that concisely in Java: Random ...READ MORE

Jul 25, 2018 in Java by samarth295
• 2,220 points
984 views
+1 vote
3 answers

What is the syntax to declare and initialize an array in java?

You can use this method: String[] strs = ...READ MORE

Jul 25, 2018 in Java by samarth295
• 2,220 points
3,177 views
0 votes
0 answers

what is class component in react ?

Jan 12 in Java by Evanjalin
• 360 points
102 views
0 votes
0 answers

How to iterate arraylist in java?

How does one perform iteration over an ...READ MORE

Dec 19, 2023 in Java by Saniya
• 3,320 points
174 views
0 votes
0 answers

How to capitalize first letter in java?

How can one implement the capitalization of ...READ MORE

Dec 19, 2023 in Java by Saniya
• 3,320 points
167 views
0 votes
0 answers

how to compile java code in command prompt

how to compile java code in command ...READ MORE

Nov 29, 2023 in Java by Priyanka
• 700 points
138 views
0 votes
0 answers

why so JavaScript and java have similar name

Nov 29, 2023 in Java by Priyanka
• 700 points
164 views
0 votes
0 answers

how to sort 2d array in java ?

Nov 29, 2023 in Java by Evanjalin
• 360 points
242 views
0 votes
1 answer

How to reverse a string in java word by word?

Here is the code to reverse a ...READ MORE

Dec 13, 2023 in Java by Anu
198 views