Most viewed questions in Java

0 votes
1 answer

Can we use multiline String in Java?

It is not possible directly to use Multiline ...READ MORE

Jun 19, 2018 in Java by sharth
• 3,370 points
538 views
0 votes
1 answer

How to configure Android SDK for finding JDK

Actual SETUP: OS: Windows 8.1 JDK file: jdk-8u11-windows-x64.exe ADT file: ...READ MORE

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

Write a method

Hey, @MIH, You can follow this: public class ReverseNumber ...READ MORE

Jun 5, 2020 in Java by Gitika
• 65,910 points
529 views
0 votes
1 answer

Java Static nested class

Hi, to understand their usage, you must ...READ MORE

Jun 8, 2018 in Java by v.liyyah
• 1,300 points
529 views
0 votes
0 answers

What is the difference between List.of and Arrays.asList?

In java 9, new factory methods for ...READ MORE

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

Array of Objects

You can also do : A[] a = ...READ MORE

Aug 3, 2018 in Java by sharth
• 3,370 points
527 views
0 votes
1 answer

Java's default package

Yes, technically, using the package names should ...READ MORE

Oct 9, 2018 in Java by code.reaper12
• 3,500 points
526 views
0 votes
1 answer

How do I join 2 lists

This is not a simpler method, but ...READ MORE

May 11, 2018 in Java by sharth
• 3,370 points
526 views
0 votes
0 answers

How to round to at most 2 decimal places, if necessary

I'd like to round at most two ...READ MORE

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

Need for finalize() in Java

finalize() is a method called by the ...READ MORE

May 9, 2018 in Java by code.reaper12
• 3,500 points
524 views
0 votes
1 answer

Reflection: Explanation and Uses

Reflection API is used to modify or examine the behavior ...READ MORE

May 2, 2018 in Java by sharth
• 3,370 points
524 views
0 votes
1 answer

How to remove ‘char’ from a String?

Hi...here you can try using the overloaded ...READ MORE

May 22, 2018 in Java by code.reaper12
• 3,500 points
523 views
0 votes
1 answer

Iterate through a HashMap.

Iterate through the entrySet() like so: public static void printMap(Map ...READ MORE

Dec 22, 2020 in Java by Gitika
• 65,910 points
518 views
0 votes
1 answer

parse int value from a char

Check Character.getNumericValue(char). String element = "el7"; int x = Character.getNumericValue(element.charAt(2)); System.out.println("x=" ...READ MORE

May 29, 2018 in Java by Parth
• 4,630 points
517 views
0 votes
0 answers

jQuery.click() vs onClick

I have a huge jQuery application, and ...READ MORE

Feb 8, 2022 in Java by Rahul
• 9,670 points
516 views
0 votes
0 answers

Can anyone explain Autowiring in Spring ?

Say I have a service class called UserServiceImpl that ...READ MORE

Jan 11, 2019 in Java by Sushmita
• 6,910 points
516 views
0 votes
1 answer

no 'access-control-allow-origin' header is present on the requested resource

The java <class-name> command syntax is one ...READ MORE

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

Sort a HashMap in Java

Convert hashmap to an ArrayList with a ...READ MORE

Jul 13, 2018 in Java by Daisy
• 8,120 points
510 views
0 votes
2 answers

Copying Objects in Java

class DummyBean { private String dummy; ...READ MORE

Aug 6, 2018 in Java by Sushmita
• 6,910 points
510 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 509 views
0 votes
1 answer

What are the practical uses for AtomicInteger?

There are two main uses of AtomicInteger: As an ...READ MORE

Jul 18, 2018 in Java by Akrati
• 960 points
509 views
0 votes
1 answer

What is the native keyword in Java?

The native keyword is applied to a method to ...READ MORE

Jul 16, 2018 in Java by scarlett
• 1,290 points
506 views
0 votes
1 answer

Rotate elements of array by n position

Here is what I came up with,  import ...READ MORE

Mar 3, 2019 in Java by Priyaj
• 58,090 points
504 views
0 votes
2 answers

How to make a new List in Java?

Initializing a List in Java The Java.util.List is a child ...READ MORE

Dec 28, 2020 in Java by Thomas Walenta
502 views
0 votes
1 answer

What issues should be considered when we are overriding equals and hashCode in Java?

equals() must define an equivalent relation and ...READ MORE

Jun 21, 2018 in Java by Sushmita
• 6,910 points
498 views
0 votes
2 answers

Avoiding != null statements

public String getPostcode(Person person) { ...READ MORE

Aug 20, 2018 in Java by Daisy
• 8,120 points
497 views
0 votes
1 answer

How to remove the last character from a string?

Hi@akhtar, You can use the StringBuffer class. It provides ...READ MORE

Dec 30, 2020 in Java by MD
• 95,440 points
496 views
0 votes
1 answer

How can I get Key from their respective Values

public class NewClass1 { ...READ MORE

May 16, 2018 in Java by Parth
• 4,630 points
493 views
0 votes
1 answer

How to show console in jsfiddle

Normally by pressing F12 or using inspect ...READ MORE

Nov 7, 2022 in Java by Damonlang
• 700 points
491 views
0 votes
1 answer

Checking results values using Java ResultSet

As per my knowledge what you are ...READ MORE

Aug 16, 2018 in Java by code.reaper12
• 3,500 points
491 views
0 votes
0 answers

What is the difference between contiguous and non-contiguous arrays?

In the numpy manual about the reshape() function, it ...READ MORE

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

Remove duplicate values from JS array

I have a pretty simple JavaScript arr ...READ MORE

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

How can we use java property files?

You can refer the below code: Properties properties ...READ MORE

Jun 28, 2018 in Java by Akrati
• 960 points
488 views
0 votes
1 answer

Mathematical Operations in Java

Ok. This is happening because you're dividing ...READ MORE

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

How to avoid Java code in JSP files?

Hello @kartik, JSTL offers tags for conditionals, loops, sets, ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,880 points
484 views
0 votes
0 answers

Data access object (DAO) in Java

I was going through a document and ...READ MORE

Apr 19, 2022 in Java by Rahul
• 3,380 points
483 views
0 votes
0 answers

How to manage two JRadioButtons in java so that only one of them can be selected at a time?

How to manage two JRadioButtons in java ...READ MORE

Apr 21, 2020 in Java by kartik
• 37,510 points
482 views
0 votes
0 answers

What is VanillaJS?

I have a simple query that has ...READ MORE

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

Javascript counting number of objects in object

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

Nov 17, 2022 in Java by Nicholas
• 7,760 points
480 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
480 views
0 votes
1 answer

How can we use wait and notify in Java?

You can refer to this: synchronized (someObject) { ...READ MORE

Jul 12, 2018 in Java by sophia
• 1,400 points
480 views
0 votes
1 answer

Refresh a page using JavaScript or HTML

window.location.reload(); in JavaScript <meta http-equiv="refresh" content="1"> in HTML ...READ MORE

Nov 7, 2022 in Java by Damonlang
• 700 points
479 views
0 votes
1 answer

what does javabean actually means?

A JavaBean is just a standard All properties ...READ MORE

Jun 7, 2018 in Java by anonymous
478 views
0 votes
1 answer

how to do global variable declaration in java

Hello,​ Global varriable which is defined after the ...READ MORE

Apr 3, 2020 in Java by Niroj
• 82,880 points
474 views
0 votes
1 answer

Running Java program without main method.

This would have worked fine till Java ...READ MORE

Nov 21, 2018 in Java by Anoop
474 views
0 votes
1 answer

String related Hash Functions

Usually hashes wouldn't do sums, otherwise stop and pots will have ...READ MORE

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

Enums be subclassed to add new elements?

I suggest you take the other way ...READ MORE

Aug 29, 2018 in Java by Parth
• 4,630 points
473 views
0 votes
1 answer

ArrayIndexOutOfBoundsException in Java

The index of array starts from 0. public ...READ MORE

Nov 23, 2018 in Java by Namitha
472 views
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