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,710 points
778 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,680 points
683 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,710 points
640 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,680 points
558 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,710 points
553 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
405 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,680 points
374 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 26,893 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
623 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,853 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
618 views
0 votes
1 answer

Testing question and answer

Testing question and answer. READ MORE

Nov 16, 2021 in Java by anonymous
• 300 points
463 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
526 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
36,110 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
21,146 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
20,830 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 38,412 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,770 points
22,211 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,870 points
29,266 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,020 points
39,349 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,770 points
10,148 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,350 points
37,443 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,710 points
3,213 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
15,610 views
0 votes
2 answers

How to generate a class at runtime?

Yes, I recently met this library which ...READ MORE

Apr 15, 2020 in Java by Edureka
• 520 points
18,817 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,770 points
6,744 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
29,489 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,770 points
6,205 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,770 points
6,098 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
7,123 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,770 points
5,455 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,920 points
43,197 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
20,130 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
14,384 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
15,478 views
0 votes
1 answer

Error:java.lang.OutOfMemoryError: Java heap space in Maven

Hello @kartik, Here is the whole config that ...READ MORE

Jun 3, 2020 in Java by Niroj
• 82,840 points
13,059 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
2,859 views
0 votes
2 answers

What's the difference between @JoinColumn and mappedBy when using a JPA @OneToMany association?

JPA mapping annotation can be classified as ...READ MORE

Oct 28, 2020 in Java by bjjj
• 140 points
21,340 views
0 votes
1 answer

How to get comments by given user in Facebook Graph API? Can we get list of comments made by given user?

Hii kartik, You can get the list of ...READ MORE

May 7, 2020 in Java by Niroj
• 82,840 points
12,723 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,770 points
2,663 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,770 points
2,339 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,770 points

edited Jul 6, 2023 by Khan Sarfaraz 2,092 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,770 points
2,341 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,770 points
2,034 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,770 points
2,307 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,770 points
1,974 views
0 votes
1 answer

What is a serialVersionUID and why should we use it?

Hello @kartik, SerialVersionUID is a unique identifier for each ...READ MORE

May 28, 2020 in Java by Niroj
• 82,840 points
11,185 views
0 votes
1 answer

does java support operator overloading?

Java doesn't supports operator overloading because it's just a ...READ MORE

Jun 18, 2018 in Java by Akrati
• 960 points
41,739 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
1,681 views