Trending questions in Java

0 votes
1 answer

“Unable to load native-hadoop library for your platform” warning: How to resolve it?

If you are running Hadoop on 64bit CentOS, ...READ MORE

Jan 4, 2019 in Java by Daisy
• 8,120 points
2,160 views
0 votes
1 answer

How to convert a date string to a DateTime object using Joda Time library?

DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss"); DateTime dt = ...READ MORE

Jan 9, 2019 in Java by Daisy
• 8,120 points
1,919 views
0 votes
1 answer

How is inheritance in C++ different than that in Java?

The purpose of inheritance is same for ...READ MORE

Feb 6, 2019 in Java by Priyaj
• 58,090 points
733 views
0 votes
2 answers

How can I invoke a method when the method name is in the form of a given string?

You could probably use method invocation from reflection: Class<?> ...READ MORE

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

Why Object is Super Class in Java?

Object is an exception to the first rule, ...READ MORE

Feb 7, 2019 in Java by Dheeraj
635 views
0 votes
2 answers

How can we convert java.util.Date to java.sql.date in Java?

It's easy to convert a java.util.Date object ...READ MORE

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

Aligning Diagram in Java

Without any evidence otherwise, I'd guess you've over-ridden the paint method ...READ MORE

Feb 11, 2019 in Java by developer_1
• 3,320 points
384 views
0 votes
1 answer

Evaluating a math expression given in string form

import javax.script.ScriptEngineManager; import javax.script.ScriptEngine; import javax.script.ScriptException; public class Test { ...READ MORE

Oct 12, 2018 in Java by Daisy
• 8,120 points
5,633 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,210 points
3,625 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,231 views
0 votes
2 answers

Unfortunately MyApp has stopped. How do I solve this?

The common solution for solving App has ...READ MORE

Mar 6, 2019 in Java by AllisonE
• 180 points
755 views
0 votes
2 answers

How to convert a java string into byte array

Try using String.getBytes(). It returns a byte[] ...READ MORE

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

$ in a variable name in Java

Java compiler uses "$" symbol internally to decorate ...READ MORE

Oct 10, 2018 in Java by code.reaper12
• 3,500 points
5,650 views
0 votes
1 answer

Static Map initialization in Java

I would suggest you to use the ...READ MORE

May 4, 2018 in Java by Akrati
• 3,190 points
12,464 views
0 votes
1 answer

String related Hash Functions

Usually hashes wouldn't do sums, otherwise stop and pots will have ...READ MORE

Feb 5, 2019 in Java by developer_1
• 3,320 points
466 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,182 views
0 votes
2 answers

how to increase heap size in java?

Here is how you can increase the ...READ MORE

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

String mapping without Case-Sensitivity

Yes, contains is case sensitive. You can ...READ MORE

Feb 5, 2019 in Java by developer_1
• 3,320 points
435 views
+2 votes
1 answer

How to import an existing x509 certificate and private key in Java keystore to use in SSL?

keytool does not provide such basic functionality ...READ MORE

Dec 19, 2018 in Java by Daisy
• 8,120 points
2,394 views
0 votes
2 answers

Is there any way to declare an array in-line?

Another way to do that, if you ...READ MORE

Aug 30, 2019 in Java by Sirajul
• 59,230 points
398 views
0 votes
2 answers

Get all the permutations of a string in Java

You could use recursion to do this.  Try ...READ MORE

Aug 21, 2019 in Java by Sirajul
• 59,230 points
1,845 views
0 votes
2 answers

How do I get the current date and time using Java?

If you require a time stamp in ...READ MORE

Aug 23, 2019 in Java by Sirajul
• 59,230 points
2,362 views
0 votes
1 answer

Can I help with the gradle code for AspectJ?

You can go to maven repositories https://mvnrepository.com/artifact/org.aspectj/aspectjtools/1.9.2 ...READ MORE

Jan 9, 2019 in Java by Frankie
• 9,830 points
1,200 views
0 votes
2 answers

Reserving space for a heap object

Run the JVM with -XX:MaxHeapSize=512m (or any big number ...READ MORE

Aug 26, 2019 in Java by Sirajul
• 59,230 points
987 views
0 votes
2 answers

How to parse/format dates with LocalDateTime? (Java 8)

Converting LocalDateTime to Time Zone ISO8601 String LocalDateTime ...READ MORE

Dec 6, 2018 in Java by Sushmita
• 6,910 points
3,789 views
0 votes
1 answer

How to resolve the error: could not find or load main class?

If you are getting error: could not ...READ MORE

May 28, 2018 in Java by Parth
• 4,630 points
10,853 views
+1 vote
2 answers

Is there a code to find 64-bit JVM or 32-bit JVM (from within a program)?

Do I need to understand the difference ...READ MORE

Jun 11, 2019 in Java by Jim
• 810 points
2,026 views
0 votes
1 answer

Creating a JUnit Test Suite Class

To create a test suite we will use the ...READ MORE

Jan 17, 2019 in Java by Frankie
• 9,830 points
678 views
0 votes
1 answer

How can I run test methods in specific order in JUnit4?

@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class SampleTest { ...READ MORE

Jan 7, 2019 in Java by Daisy
• 8,120 points
1,067 views
0 votes
1 answer

How can we override back button to act like home button?

Most of the time you need to ...READ MORE

Dec 14, 2018 in Java by Daisy
• 8,120 points
2,029 views
0 votes
2 answers

How can I convert a String variable to a primitive int in Java

 Here are two ways illustrating this: Integer x ...READ MORE

Aug 20, 2019 in Java by Sirajul
• 59,230 points
1,915 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,932 views
0 votes
1 answer

How to specify the certificate to use for authenticating the server to client?

You can try the command given below. System.setProperty("javax.net ...READ MORE

Jan 2, 2019 in Java by Daisy
• 8,120 points
1,096 views
0 votes
2 answers

How to play .mp3 and .wav in Java?

We can use Java API to play ...READ MORE

Dec 7, 2018 in Java by Sushmita
• 6,910 points
5,390 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,300 views
0 votes
2 answers

Does Java thread.sleep() puts swing ui to sleep?

You are correct about the code putting ...READ MORE

Oct 24, 2018 in Java by Sushmita
• 6,910 points
4,614 views
0 votes
2 answers

How can I split the String with any whitespace character as delimiter?

String string = "Today's weather"; String[] arrayOfString = ...READ MORE

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

Difference between FetchType LAZY and EAGER in Java Persistence API?

Sometimes you have two entities and there's ...READ MORE

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

Ways to compare String Values

== compares object references, it checks to see ...READ MORE

Jan 14, 2019 in Java by developer_1
• 3,320 points
459 views
0 votes
1 answer

Unable to Run the .java file

You have to enter the commands as ...READ MORE

Jan 11, 2019 in Java by Omkar
• 69,210 points
608 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,458 views
0 votes
1 answer

Exception Handling: “ConcurrentModificationException” while removing elements from `ArrayList` while iterating it

Iterator<String> iter = myArrayList.iterator(); while (iter.hasNext()) { ...READ MORE

Jan 10, 2019 in Java by Sushmita
• 6,910 points
582 views
0 votes
2 answers

How to convert ArrayList<String> to String[] in Java

Try this:  String[] strArray = arrayList.toArray(new Str ...READ MORE

Aug 21, 2019 in Java by Sirajul
• 59,230 points
749 views
0 votes
0 answers

Can anyone explain Autowiring in Spring ?

Say I have a service class called UserServiceImpl that ...READ MORE

Jan 11, 2019 in Java by Sushmita
• 6,910 points
509 views
0 votes
1 answer

Retrieving the path of a running jar file

Its quite simple. Try using the below ...READ MORE

May 25, 2018 in Java by geek.erkami
• 2,680 points
10,342 views
0 votes
2 answers

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

new BigDecimal(String.valueOf(double)).setScale(yourScale, BigDecimal.ROUND_HALF_UP); will get you a BigDecimal. To ...READ MORE

Aug 26, 2019 in Java by Sirajul
• 59,230 points
1,294 views
0 votes
3 answers

Is it possible to take char input from scanner?

// Use a BufferedReader to read characters ...READ MORE

Sep 7, 2018 in Java by Daisy
• 8,120 points
8,556 views
0 votes
1 answer

Using Jackson to deserialise an array of object

First create a mapper : import com.fasterxml.jackson.databind.ObjectMapper;// in ...READ MORE

Sep 26, 2018 in Java by Sushmita
• 6,910 points
4,946 views
0 votes
1 answer

Comparing Functions in Java

I would suggest that Version 1 is ...READ MORE

Jan 9, 2019 in Java by developer_1
• 3,320 points
357 views
+1 vote
2 answers

What is an Object?

Hey @preetiagarwal, your description is an answer ...READ MORE

Dec 24, 2018 in Java by Priyaj
• 58,090 points
957 views