Most viewed questions in Java

0 votes
1 answer

How to create a memory leak in Java?

Hello @kartik, A simple thing to do is ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,880 points
471 views
0 votes
1 answer

How do I convert from int to String?

Normal ways would be Integer.toString(i) or String.valueOf(i). The concatenation will work, ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,910 points
469 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
469 views
0 votes
0 answers

window.location.href and window.open () methods in JavaScript

What is the difference between window.location.href and ...READ MORE

Apr 26, 2022 in Java by Rahul
• 3,380 points
468 views
0 votes
1 answer

Ways to compare String Values

== compares object references, it checks to see ...READ MORE

Jan 14, 2019 in Java by developer_1
• 3,320 points
468 views
0 votes
0 answers

Generate random number between two numbers in JavaScript

Is it possible to use JavaScript to ...READ MORE

Sep 28, 2022 in Java by Nicholas
• 7,760 points
465 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
463 views
0 votes
0 answers

How can I get bootstrap version via javascript?

Is there any way to get bootstrap ...READ MORE

Apr 13, 2022 in Java by Rahul
• 3,380 points
461 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
461 views
0 votes
1 answer

Increasing the JVM memory using command line

You can adjust your JVM memory needs by ...READ MORE

Sep 25, 2018 in Java by geek.erkami
• 2,680 points
461 views
0 votes
0 answers

Loop over an array in JavaScript

How can I use JavaScript to loop ...READ MORE

Dec 9, 2022 in Java by Nicholas
• 7,760 points
460 views
0 votes
1 answer

String mapping without Case-Sensitivity

Yes, contains is case sensitive. You can ...READ MORE

Feb 5, 2019 in Java by developer_1
• 3,320 points
460 views
0 votes
1 answer

Use of Static Keyword in a Class

It means that there is only one ...READ MORE

May 29, 2018 in Java by Rishabh
• 3,620 points
460 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
1 answer

Compare two dates with JavaScript

 The Date object will do what you ...READ MORE

Feb 18, 2022 in Java by Rahul
• 9,670 points
456 views
0 votes
1 answer

How to set JFrame to appear centered, regardless of monitor resolution?

Hello kartik, You can  always did it in ...READ MORE

May 7, 2020 in Java by Niroj
• 82,880 points
455 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 454 views
0 votes
1 answer

What do we understand from string pool in java?

This prints true (even though we don't use equals method: correct ...READ MORE

Apr 30, 2018 in Java by Daisy
• 8,120 points
454 views
0 votes
1 answer

ThreadLocal variables usage in Java

public class Test { // ...READ MORE

Jun 30, 2018 in Java by code.reaper12
• 3,500 points
453 views
0 votes
1 answer

What's the difference between using "let" and "var"?

The main difference is scoping rules wherein ...READ MORE

Feb 17, 2022 in Java by Aditya
• 7,680 points
452 views
0 votes
0 answers

Javac file not found error.

I'm completely new to java. I spent ...READ MORE

Nov 21, 2021 in Java by anonymous
• 120 points
452 views
0 votes
1 answer

Unexpected result on Subtracting Times

ou've encountered a local time discontinuity: When local standard ...READ MORE

May 29, 2018 in Java by Rishabh
• 3,620 points
452 views
0 votes
0 answers

Arrays.fill with multidimensional array in Java

Without using a loop, how can I ...READ MORE

Nov 16, 2022 in Java by Ashwini
• 5,430 points
450 views
0 votes
0 answers

how to compare two strings in java?

how to compare two strings in java? READ MORE

Nov 16, 2021 in Java by Naresh
• 210 points
450 views
0 votes
0 answers

Generating random whole numbers in JavaScript in a specific range

How can I create random whole numbers ...READ MORE

Sep 28, 2022 in Java by Nicholas
• 7,760 points
449 views
0 votes
1 answer

Replacing a String with a character

Yes, you are missing out on a ...READ MORE

May 17, 2018 in Java by geek.erkami
• 2,680 points
449 views
0 votes
1 answer

How to make an Android device vibrate?

Hello @kartik, Try: import android.os.Vibrator; Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); // ...READ MORE

May 25, 2020 in Java by Niroj
• 82,880 points
448 views
0 votes
1 answer

What is casting variable in java?

Casting is, taking an Object of one ...READ MORE

Jul 17, 2018 in Java by scarlett
• 1,290 points
444 views
0 votes
0 answers

How do I check if an array includes a value in JavaScript?

What is the shortest and most efficient ...READ MORE

Sep 28, 2022 in Java by Nicholas
• 7,760 points
443 views
0 votes
1 answer

How to remove object from an Array?

Here is a code I came up ...READ MORE

Mar 11, 2019 in Java by Esha Gupta
443 views
0 votes
1 answer

How to implement constants in java

Here is the solution- public static final TYPE ...READ MORE

May 28, 2018 in Java by sophia
• 1,400 points
443 views
0 votes
0 answers

How to sort an array of integers correctly

Trying to retrieve the greatest and lowest ...READ MORE

Sep 28, 2022 in Java by Nicholas
• 7,760 points
442 views
0 votes
0 answers

Why were Javascript `atob()` and `btoa()` named like that?

A base64 string and window are both ...READ MORE

Nov 9, 2022 in Java by Nicholas
• 7,760 points
440 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
440 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
438 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
437 views
0 votes
1 answer

how to serially execute selenium maven project?

Hi, @Beigi, Do check you have all the ...READ MORE

Oct 27, 2020 in Java by Nisha
436 views
0 votes
0 answers

What does it mean that Java arrays are homogeneous, but ArrayLists are not?

If I got a Type[] array, I ...READ MORE

Aug 1, 2022 in Java by krishna
• 2,820 points
435 views
0 votes
0 answers

Javascript counting number of objects in object

I have an object something like: Object {0=Object, ...READ MORE

Nov 15, 2022 in Java by Nicholas
• 7,760 points
433 views
0 votes
1 answer

Which is the standard concise way to copy a file in Java?

As toolkit mentions above, Apache Commons IO ...READ MORE

Nov 15, 2018 in Java by Frankie
• 9,830 points
433 views
0 votes
0 answers

Converting Java objects to JSON with Jackson

I need my JSON to be like ...READ MORE

May 23, 2022 in Java by Kichu
• 19,050 points
432 views
0 votes
0 answers

HOw can i do this?

The department of History has just bought ...READ MORE

Apr 16, 2020 in Java by MIH
• 150 points
429 views
0 votes
1 answer

How do I copy an object in Java?

Create a copy constructor: class DummyBean { ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,910 points

edited Jul 4, 2023 by Khan Sarfaraz 427 views
0 votes
1 answer

How do I efficiently iterate over each entry in a Java Map?

To answer your questions, use the following ...READ MORE

Feb 8, 2022 in Java by Soham
• 9,700 points
426 views
0 votes
1 answer

How to create create an ArrayList from array?

new ArrayList<>(Arrays.asList(array)); READ MORE

Dec 21, 2020 in Java by Gitika
• 65,910 points
425 views
0 votes
0 answers

How to avoid java.util.ConcurrentModificationException when iterating through and removing elements from an ArrayList

I wanted to iterate over an ArrayList ...READ MORE

May 23, 2022 in Java by Kichu
• 19,050 points
422 views
0 votes
1 answer

Number of lines in a file in Java

I found this an efficient way in counting ...READ MORE

Jul 4, 2018 in Java by scarlett
• 1,290 points
420 views
0 votes
1 answer

Parsing a string to a date in JavaScript

The best string format for string parsing ...READ MORE

Feb 18, 2022 in Java by Aditya
• 7,680 points
417 views
0 votes
0 answers

Difference between Arrays.asList(array) and new ArrayList<Integer>(Arrays.asList(array))

What's the difference in these two ways? List<Integer> ...READ MORE

Aug 5, 2022 in Java by krishna
• 2,820 points
416 views