Latest questions in Java

0 votes
4 answers

How to convert a char to a String?

There are two ways you can do ...READ MORE

Dec 29, 2020 in Java by Roshni
• 10,520 points
840 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
490 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
534 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,910 points
2,049 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,910 points

edited Jul 5, 2023 by Khan Sarfaraz 715 views
0 votes
1 answer

Can't execute jar- file: “no main manifest attribute”

First, it's kind of weird, to see ...READ MORE

Dec 23, 2020 in Java by Gitika
• 65,910 points
2,176 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,910 points
5,658 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,910 points
724 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,910 points
2,078 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,910 points
950 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,910 points
1,241 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,910 points

edited Jul 6, 2023 by Khan Sarfaraz 1,387 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,910 points
994 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,910 points
382 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
515 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,910 points
578 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
406 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,910 points
827 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,910 points
390 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,910 points
288 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,910 points
993 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,910 points
5,176 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,910 points
1,662 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,910 points
869 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,880 points
312 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,910 points
8,823 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
• 370 points
708 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,880 points
6,311 views
0 votes
0 answers

Apache maven vs Eclipse maven plugin

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

Nov 25, 2020 in Java by zaraaq
• 270 points
587 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,880 points
2,383 views
+1 vote
2 answers

How to find all the classes of a package in Java?

Looking on internet I found this page with ...READ MORE

Nov 16, 2020 in Java by Juan
• 330 points
347,588 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
• 270 points

edited Nov 6, 2020 by Gitika 1,760 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,910 points
2,101 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,910 points
1,465 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
428 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 20, 2020 in Java by Kiya
2,253 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,910 points
618 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
1,107 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 4,527 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,910 points
2,059 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,520 points

edited Jul 4, 2023 by Khan Sarfaraz 3,659 views
0 votes
0 answers

I need to Post api to database using java in intellij. After testing sample api through postman i got an Sql exception saying Syntax error at or near ',' Please tell me where i made a mistake

public Result setModelMasterParams(){         try{             long tenantId = request().getHeader("tenant_id")==null                     || request().getHeader("tenant_id").equalsIgnoreCase("")                     || ...READ MORE

Aug 19, 2020 in Java by Sriram
• 120 points

recategorized Aug 19, 2020 by Niroj 1,252 views
0 votes
0 answers

Restsharp support webservice automationtesting like rest

Hi , Restsharp support webservice automationtesting like rest ...READ MORE

Aug 9, 2020 in Java by anonymous
• 3,190 points
1,545 views
0 votes
1 answer

How to use an existing database with an Android application?

Hello @kartik, If you are having pre built ...READ MORE

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

How can I get the current stack trace in Java?

Hello @kartik, Try this: Thread.currentThread().getStackTrace(); is fine if you don't ...READ MORE

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

How to directly initialize a HashMap?

Hello @Kartik, In plain java 8 you also ...READ MORE

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

How to add local jar files to a Maven project?

Hello @kartik, You can add local dependencies directly ...READ MORE

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

Error:The method must override a superclass method after importing a project into Eclipse

Hello @kartik, This problem happened when I imported ...READ MORE

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

Error:java.lang.UnsupportedClassVersionError: Unsupported major.minor version

Hello @kartik, This error means you're trying to ...READ MORE

Jul 28, 2020 in Java by Niroj
• 82,880 points
1,387 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
471 views