Most voted questions in Java

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

Where is JAVA_HOME on macOS Mojave (10.14) to Lion (10.7)?

export JAVA_HOME="$(/usr/libexec/java_home -v 1.6)" or export JAVA_HOME="$(/usr/libexec/java_home -v 1.7)" or export ...READ MORE

Dec 4, 2018 in Java by Daisy
• 8,120 points
2,322 views
0 votes
1 answer

Sending Email in Android using JavaMail API without using the default/built-in app

Send e-mail in Android using the JavaMail ...READ MORE

Dec 4, 2018 in Java by Daisy
• 8,120 points
3,211 views
0 votes
1 answer

How can you catch an exception thrown by another thread in Java?

This can be done using Thread.UncaughtExceptionHandler. Here’s a simple ...READ MORE

Dec 3, 2018 in Java by Frankie
• 9,830 points
20,279 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,695 views
0 votes
1 answer

Understanding Spring @Autowired usage

TL;DR The @Autowired annotation spares you the need ...READ MORE

Nov 30, 2018 in Java by Sushmita
• 6,910 points
1,640 views
0 votes
1 answer

Getting a File's MD5 Checksum in Java

There's an input stream decorator, java.security.DigestInputStream, so that ...READ MORE

Nov 30, 2018 in Java by Daisy
• 8,120 points
1,081 views
0 votes
3 answers

HttpServletRequest get JSON POST data

Configure the action as given below: Method: Since ...READ MORE

Dec 16, 2020 in Java by Rajiv
• 8,910 points
67,039 views
0 votes
1 answer

Java 8 List<V> into Map<K, V>

Based on Collectors documentation it's as simple as: Map<String, Choice> result ...READ MORE

Nov 29, 2018 in Java by Daisy
• 8,120 points
1,384 views
0 votes
1 answer

What is blank final variable?

A final variable in Java can be ...READ MORE

Nov 29, 2018 in Java by Frankie
• 9,830 points
1,462 views
0 votes
1 answer

What is object cloning in Java?

Object cloning means to create an exact ...READ MORE

Nov 29, 2018 in Java by Frankie
• 9,830 points
890 views
0 votes
1 answer

If The A Class Is Declared Without Any Access Modifiers, Where May The Class Be Accessed In Java Programming?

A class that is declared without any ...READ MORE

Nov 28, 2018 in Java by Frankie
• 9,830 points
2,486 views
0 votes
1 answer

Describe Heavy Weight Components Mean In Java Programming?

Heavy weight components like Abstract Window Toolkit ...READ MORE

Nov 28, 2018 in Java by Frankie
• 9,830 points
1,590 views
0 votes
1 answer

Java Client Certificate over HTTPS/SSL

The missing links was (mostly) the first ...READ MORE

Nov 28, 2018 in Java by Sushmita
• 6,910 points
6,315 views
0 votes
1 answer

Sending POST data in Android

public class CallAPI extends AsyncTask<String, String, String> ...READ MORE

Nov 28, 2018 in Java by Sushmita
• 6,910 points
1,357 views
0 votes
1 answer

Types of transaction management in Spring Framework

Well there are basically to types of ...READ MORE

Nov 28, 2018 in Java by geek.erkami
• 2,680 points
1,704 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
11,963 views
0 votes
1 answer

web.xml file is missing in my eclipse IDE

Very simple. You will find Deployment Descriptor ...READ MORE

Nov 27, 2018 in Java by Omkar
• 69,230 points
3,642 views
0 votes
1 answer

Unable to find valid certification path to requested target - error even after cert imported

Unfortunately - it could be many things ...READ MORE

Nov 27, 2018 in Java by Daisy
• 8,120 points
4,417 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,278 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
476 views
0 votes
1 answer

How is the array's address stored in memory?

In terms of memory, you have continuous blocks ...READ MORE

Nov 23, 2018 in Java by Namitha
1,236 views
0 votes
2 answers

In Java, what is the best way to determine the size of an object?

I happened to find a java class "jdk.nashorn.internal.ir.debug.ObjectSizeCalculator", ...READ MORE

Aug 19, 2019 in Java by Sirajul
• 59,230 points
12,352 views
0 votes
1 answer

JSON parsing in Java using Gson

Well, you can easily do that by ...READ MORE

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

How to handle infinite loop in Java?

You can simply add a increment statement ...READ MORE

Nov 22, 2018 in Java by Anoop
1,031 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
478 views
0 votes
1 answer

Generate 10 fibonacci numbers.

The placement of logic is wrong that ...READ MORE

Nov 21, 2018 in Java by Nabarupa
988 views
0 votes
1 answer

What is the differnece between public static void main string args[] and psvm string []args ?

Before getting to this you should understand ...READ MORE

Nov 20, 2018 in Java by Nabarupa
1,962 views
0 votes
1 answer

Concern and cross-cutting concern in Spring AOP

The concern is the behavior we want ...READ MORE

Nov 16, 2018 in Java by code.reaper12
• 3,500 points

edited Mar 4, 2022 by Sarfaraz 17,659 views
0 votes
1 answer

Serializing a lambda

With the release of Java 8, Oracle introduced the ...READ MORE

Nov 16, 2018 in Java by code.reaper12
• 3,500 points
856 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
440 views
0 votes
1 answer

How to force garbage collection in Java?

Your best option is to call System.gc() which simply ...READ MORE

Nov 15, 2018 in Java by Frankie
• 9,830 points
839 views
0 votes
1 answer

What is the maximum Java heap size of a 32-bit JVM on a 64-bit OS?

32-bit JVMs which expect to have a ...READ MORE

Nov 15, 2018 in Java by Frankie
• 9,830 points
2,695 views
0 votes
1 answer

How to change selection listener in JComboBox?

It should respond to ActionListeners, like this: combo.addActionListener (new ...READ MORE

Nov 15, 2018 in Java by Frankie
• 9,830 points
885 views
0 votes
1 answer

Reason for java.lang.IncompatibleClassChangeError

Well these kinda error generally occur when ...READ MORE

Nov 14, 2018 in Java by code.reaper12
• 3,500 points
1,813 views
0 votes
1 answer

What is Enum in Java?

 It means that the type argument for ...READ MORE

Nov 13, 2018 in Java by Frankie
• 9,830 points
638 views
0 votes
1 answer

How to call a method from Constructor?

Have a glance at below steps: You create ...READ MORE

Nov 13, 2018 in Java by Frankie
• 9,830 points
6,527 views
0 votes
1 answer

Why clone() method is protected in Java?

The clone() is protected because it is ...READ MORE

Nov 13, 2018 in Java by geek.erkami
• 2,680 points
4,255 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,474 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,688 views
0 votes
2 answers

How to move or copy a file in Java

The new JAVA Specification Request 203 -NIO will ...READ MORE

Aug 20, 2019 in Java by Sirajul
• 59,230 points
715 views
0 votes
1 answer

HTML Parsing in Java

Well, to parse HTML I used JTidy.  Basically, ...READ MORE

Nov 2, 2018 in Java by geek.erkami
• 2,680 points
339 views
0 votes
1 answer

Why do we use threads in Java?

Reasons for using Multithreading in Java: When a ...READ MORE

Nov 2, 2018 in Java by nsv999
• 5,500 points
936 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,467 views
0 votes
1 answer

varargs in Java

Well, varargs are generally used to deal ...READ MORE

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

Affinity in Java thread

Well, as far as I know, I ...READ MORE

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

Default Object.toString() in hashcode

Well, the hash code object is the ...READ MORE

Oct 31, 2018 in Java by code.reaper12
• 3,500 points
773 views
0 votes
2 answers

How to convert List<Integer> to int[] in Java?

In addition to Commons Lang, you can ...READ MORE

Aug 20, 2019 in Java by Sirajul
• 59,230 points
14,974 views
0 votes
1 answer

How to determine day of week by passing specific date?

You can use java.util.Calendar: Calendar c = Calendar.getInstance(); c.setTime(yourDate); int dayOfWeek ...READ MORE

Oct 30, 2018 in Java by Daisy
• 8,120 points
3,954 views
0 votes
1 answer

Error - trustAnchors parameter must be non-empty

This bizarre message means that the truststore ...READ MORE

Oct 29, 2018 in Java by Daisy
• 8,120 points
575 views