Trending questions in Java

0 votes
1 answer

How do I join two lists in Java?

In Java 8: List<String> newList = Stream.concat(listOne.stream(), listTwo.stream()) ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,870 points
27 views
0 votes
2 answers

Java string to date conversion

We can convert String to Date in java using parse() method ...READ MORE

Dec 28, 2020 in Java by Nikita
60 views
0 votes
2 answers

When to use static methods

Java main() method is always static, so that compiler ...READ MORE

Dec 28, 2020 in Java by Reshma
46 views
0 votes
2 answers

Reading a plain text file in Java

Read a plain text file: Java Code: import java.io.BufferedReader; import ...READ MORE

Dec 28, 2020 in Java by Nikita
42 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
48 views
0 votes
2 answers

File to byte[] in Java?

Example 1: Convert File to byte[] import java.io.IOException; import ...READ MORE

Dec 28, 2020 in Java by Reshma
34 views
0 votes
1 answer

How to install Java 8 on Mac

Oracle has a poor record for making ...READ MORE

Dec 23, 2020 in Java by Gitika
• 65,870 points
248 views
0 votes
1 answer

How to round a number to n decimal places in Java?

Use setRoundingMode, set the RoundingMode explicitly to handle your issue ...READ MORE

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

Download a file with Android, and showing the progress in a ProgressDialog

1. Use AsyncTask and show the download progress in ...READ MORE

Dec 23, 2020 in Java by Gitika
• 65,870 points
81 views
0 votes
1 answer

Can anyone help me i have been struggling for weeks now to solve this problem

Hello, @Tafadzwa, Any way just navigate to C:\Users\user.gradle\caches\ ...READ MORE

Dec 24, 2020 in Java by Gitika
• 65,870 points
37 views
0 votes
1 answer

Converting array to list in Java

In your example, it is because you ...READ MORE

Dec 23, 2020 in Java by Gitika
• 65,870 points
41 views
0 votes
1 answer

Static Classes In Java

Java has static nested classes but it sounds like ...READ MORE

Dec 23, 2020 in Java by Gitika
• 65,870 points
37 views
0 votes
1 answer

What does “Could not find or load main class” mean?

First of all, you need to understand ...READ MORE

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

What are the differences between a HashMap and a Hashtable in Java?

There are several differences between HashMap and Hashtable in Java: Hashtable is synchronized, whereas HashMap is ...READ MORE

Dec 21, 2020 in Java by Gitika
• 65,870 points
108 views
0 votes
1 answer

How does the Java 'for each' loop work?

for (Iterator<String> i = someIterable.iterator(); i.hasNext();) { ...READ MORE

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

Sort ArrayList of custom Objects by property

Since Date implements Comparable, it has a compareTo method just like String does. So your ...READ MORE

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

Convert ArrayList<String> to String[] array

Use like this. List<String> stockList = new ArrayList<String>(); stockList.add("stock1"); stockList.add("stock2"); String[] ...READ MORE

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

How do I generate random integers within a specific range in Java?

Before Java 1.7, the standard way to ...READ MORE

Dec 22, 2020 in Java by Gitika
• 65,870 points
60 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,870 points
42 views
0 votes
1 answer

Initialization of an ArrayList in one line.

Actually, probably the "best" way to initialize ...READ MORE

Dec 21, 2020 in Java by Gitika
• 65,870 points
53 views
0 votes
1 answer

When to use LinkedList over ArrayList in Java?

LinkedList and ArrayList are two different implementations of the List ...READ MORE

Dec 21, 2020 in Java by Gitika
• 65,870 points
52 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,870 points
38 views
0 votes
1 answer

Avoiding NullPointerException in Java

This to me sounds like a reasonably ...READ MORE

Dec 21, 2020 in Java by Gitika
• 65,870 points
38 views
0 votes
1 answer

How do I determine whether an array contains a particular value in Java?

Arrays.asList(yourArray).contains(yourValue) Warning: this doesn't work for arrays of ...READ MORE

Dec 21, 2020 in Java by Gitika
• 65,870 points
38 views
0 votes
1 answer

Why is subtracting these two times (in 1927) giving a strange result?

In TZDB 2014f, the time of the ...READ MORE

Dec 21, 2020 in Java by Gitika
• 65,870 points
37 views
0 votes
3 answers

How to clear the console in Java?

import java.io.IOException; public class chkClearScreen {     public static void ...READ MORE

Aug 26, 2020 in Java by ItsJustRaja
22,857 views
0 votes
1 answer

Is it possible to upload a file from desktop to web using Selenide?

Hi, @Nikhil, Yes it's possible to drop a ...READ MORE

Dec 16, 2020 in Java by Gitika
• 65,870 points
39 views
0 votes
1 answer

Logger cannot be resolved Java(570425394) Error occured

Hey, @Boopathy, Could you please post your code ...READ MORE

Dec 1, 2020 in Java by Gitika
• 65,870 points
286 views
0 votes
1 answer

What does Animal a = (Animal) data[0]; do?

Hello @zaraaq , You can refer this for your ...READ MORE

Dec 2, 2020 in Java by Niroj
• 82,580 points
60 views
0 votes
1 answer

How to return JSON response from Flask view?

Hello, Pass the summary data to the jsonify function, which ...READ MORE

Nov 20, 2020 in Java by Niroj
• 82,580 points
530 views
0 votes
0 answers

I have Added all External JAR files but driver not found exception occured

Exception in thread "main" java.lang.Error: Unresolved compilation ...READ MORE

Nov 29, 2020 in Java by Boopathy
• 350 points
114 views
0 votes
1 answer

How to redirect to an external URL from controller action in Spring MVC?

Hello @kartik, You can do it with two ...READ MORE

May 22, 2020 in Java by Niroj
• 82,580 points
8,293 views
0 votes
1 answer

Maven project using testng dependecy

Hello @zaraaq, First try to replace the scope ...READ MORE

Nov 25, 2020 in Java by Niroj
• 82,580 points
176 views
0 votes
0 answers

Apache maven vs Eclipse maven plugin

Hi, I want to install maven but don't ...READ MORE

Nov 24, 2020 in Java by zaraaq
• 260 points
64 views
0 votes
2 answers

Android Studio Gradle project “Unable to start the daemon process /initialization of VM”

In IONIC Go To > Platform > Android >Cordova ...READ MORE

Dec 16, 2020 in Java by Shahzaib
3,329 views
0 votes
0 answers

what is cannot find symbol this(SimpleTimeLimiter.create(THREAD_POOL));

Hi, Through command line, I'm trying to compile ...READ MORE

Nov 6, 2020 in Java by zaraaq
• 260 points

edited Nov 6, 2020 by Gitika 249 views
+1 vote
1 answer

Multithreading in Java with priorities

HI, @Juan, By default, a thread inherits the priority of its parent thread. ...READ MORE

Nov 6, 2020 in Java by Gitika
• 65,870 points
143 views
0 votes
1 answer

Could not include JAR files

Hey, @Boopathy, Which command do you use to ...READ MORE

Oct 27, 2020 in Java by Gitika
• 65,870 points
116 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
61 views
0 votes
1 answer

Can i know where is java logs on centos 7?

Hey! Have you checked <user.home>/.java/deployment/log ? READ MORE

Oct 19, 2020 in Java by Kiya
223 views
0 votes
1 answer

Java replace : replace all charecters with space except the matched string like "test"

Hi, @jyra, You can go through this example:  String ...READ MORE

Oct 14, 2020 in Java by Gitika
• 65,870 points
98 views
0 votes
1 answer

Error:No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call

Hii @kartik, If you have @Transactional // Spring Transactional class ...READ MORE

May 22, 2020 in Java by Niroj
• 82,580 points
6,358 views
0 votes
0 answers

How to store and fetch nested json data from dynamodb in java

I want to maintain a book library. ...READ MORE

Sep 7, 2020 in Java by saswat
• 120 points

edited Sep 7, 2020 by Gitika 1,265 views
0 votes
1 answer

Gradle - Error Could not find method implementation() for arguments

Hello @kartik, Make sure your gradle version 3.. or ...READ MORE

May 26, 2020 in Java by Niroj
• 82,580 points
5,663 views
0 votes
2 answers

I want list of date of every week based on pass dynamically "Mon ,Tue, Wed, Thu, Fri, Sat, Sun" between startDate and endDate using Java 8 LocaleDate

public List<LocalDate> getWeeklyDateByStringofDays(String daysOfWeek, LocalDate startDate, ...READ MORE

Sep 14, 2020 in Java by anonymous
• 190 points
177 views
0 votes
2 answers

What is the difference between Map and HashMap in java?

The basic difference is : Map is ...READ MORE

Aug 28, 2019 in Java by Sirajul
• 58,990 points
18,380 views
0 votes
1 answer

how to get cache memory size of a application in android

To find the size of the cache ...READ MORE

Sep 4, 2020 in Java by Rajiv
• 8,880 points
377 views
0 votes
2 answers

How to log SQL statements in Spring Boot?

HI.. try using this in your properties file: logging.level.org. ...READ MORE

Sep 24, 2020 in Java by SRI

edited Sep 24, 2020 by Sirajul 2,138 views
0 votes
1 answer

How to set base url for rest in spring boot?

Hello @kartik, Set it up in your application.yml ...READ MORE

May 22, 2020 in Java by Niroj
• 82,580 points
4,817 views
0 votes
1 answer

How to set path if java is installed in E drive or D drive rather than c

Hello, @Amazing, It doesn't really matter where you ...READ MORE

Sep 1, 2020 in Java by Roshni
• 10,420 points
158 views