Trending questions in Java

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

How to split a string in Java

By using the appropriate method, this can ...READ MORE

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

window.onload vs document.onload

For the window.onload by default, it fires ...READ MORE

Feb 9, 2022 in Java by Rahul
• 9,670 points
151 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
185 views
0 votes
1 answer

Reverse a string in Java

To answer your question, you can use ...READ MORE

Feb 8, 2022 in Java by Soham
• 9,700 points
140 views
0 votes
0 answers

How do I declare and initialize an array in Java?

How do I declare and initialize an ...READ MORE

Feb 8, 2022 in Java by Edureka
• 120 points
133 views
0 votes
0 answers

For-each over an array in JavaScript

How can I loop through all the ...READ MORE

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

SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”

I had the same issue with WebSphere ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,910 points
16,364 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
280 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
200 views
0 votes
1 answer

Testing question and answer

Testing question and answer. READ MORE

Nov 16, 2021 in Java by anonymous
• 300 points
139 views
0 votes
0 answers

how to find lenght of string in java ?

java READ MORE

Nov 12, 2021 in Java by anonymous
• 210 points
211 views
0 votes
0 answers

Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/HasAuthentication

Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/HasAuthentication at java.base/java.lang.ClassLoader.defineClass1(Native ...READ MORE

Oct 22, 2021 in Java by anonymous
• 120 points
1,035 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,840 points

edited Mar 4, 2022 by Sarfaraz 22,022 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
33,105 views
+1 vote
4 answers

What is a simple way to repeat a string in java?

There is already answer wriiten using StringBuilder ...READ MORE

Dec 16, 2020 in Java by Rajiv
• 8,910 points
27,517 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,840 points
18,269 views
0 votes
2 answers

How do I convert a String to an int in Java?

Use the lines of code mentioned below:- String ...READ MORE

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

How to run a .java file from command line passing arguments in Maven?

Hello @kartik, You could run: mvn exec:exec -Dexec.args="arg1". This will ...READ MORE

Jun 3, 2020 in Java by Niroj
• 82,840 points
15,181 views
0 votes
2 answers

How to convert InputStream to byte array in Java?

The class IOUtils, lib: https://mvnrepository.com/artifact/com ...READ MORE

Sep 24, 2020 in Java by Anthony
13,191 views
0 votes
1 answer

Convert data in List<JsonNode> to Map <String,String> in Java

Hi, @Jyra, Basically, you can use the object mapper to ...READ MORE

Apr 7, 2020 in Java by Gitika
• 65,910 points
16,714 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
5,835 views
0 votes
1 answer

How to find the nth prime number in Java?

Here is the code to find nth ...READ MORE

Mar 4, 2019 in Java by Priyaj
• 58,100 points
33,184 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
• 59,230 points
27,298 views
0 votes
1 answer

Unsupported major.minor version 52.0

The issue is because of a Java ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,910 points
4,052 views
0 votes
1 answer

How to refresh data in ViewPager Fragment ?

Using the ViewPager.OnPageChangeListener is the correct way to go, ...READ MORE

Mar 7, 2019 in Java by developer_1
• 3,310 points
32,511 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
4,053 views
0 votes
1 answer

Removing whitespace from strings in Java

st.replaceAll("\\s+","") removes all whitespaces and non-visible characters (e.g., ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,910 points
3,644 views
+1 vote
2 answers

Retrieve all the implementations of an interface in Java

Take a look to this example: https://github.com/burningwave/co ...READ MORE

Dec 21, 2019 in Java by Roberto
• 460 points

edited Jul 7, 2020 by Roberto 30,611 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
3,387 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,840 points
12,412 views
0 votes
2 answers

Resolving PKIX path building failed Error?

You need to add the certificate for App2 to ...READ MORE

Sep 24, 2018 in Java by Sushmita
• 6,900 points
40,208 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,840 points
3,818 views
+2 votes
1 answer

How to pass dynamic JSON request with parameter in POST request using Rest assured java?

here payload is short you can also ...READ MORE

Jul 23, 2020 in Java by Vivek
17,222 views
0 votes
1 answer

How do I count the number of occurrences of a char in a String?

My 'idiomatic one-liner' for this is: int count ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,910 points
1,569 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
1,625 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
1,591 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
1,605 views
0 votes
1 answer

How to read all files in a folder from Java?

public void listFilesForFolder(final File folder) { ...READ MORE

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

How do I save a String to a text file using Java?

If you're simply outputting text, rather than ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,910 points
1,167 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,308 views
0 votes
1 answer

How to convert Java String into byte[]?

The object your method decompressGZIP() needs is a byte[]. So the ...READ MORE

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

JsonMappingException: No suitable constructor found for type [simple type, class ]: can not instantiate from JSON object?

Hello @kartik, his happens for these reasons: your inner ...READ MORE

Apr 8, 2020 in Java by Niroj
• 82,840 points
12,367 views
0 votes
1 answer

Implements vs extends: When to use? What's the difference?

Extends is for extending a class. implements are for implementing an interface The difference between ...READ MORE

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

How to append text to an existing file in Java?

Java 7+ If you just need to do ...READ MORE

Dec 30, 2020 in Java by Gitika
• 65,910 points
626 views
0 votes
3 answers

How to check if a String is numeric in Java?

Check if a string is numeric public class ...READ MORE

Dec 29, 2020 in Java by Carlos
594 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
937 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
932 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 29, 2020 in Java by Nikita
562 views