Latest questions in Java

0 votes
1 answer

How do you produce a double in Java

double num = 5; When you do this, ...READ MORE

Oct 3, 2018 in Java by anto.trigg4
• 3,440 points
34 views
0 votes
1 answer

How to Read/Write String from a File in Android

Writing a File in android: private void writeToFile(String ...READ MORE

Oct 3, 2018 in Java by sharth
• 3,370 points
1,028 views
0 votes
3 answers

How does the “final” keyword in Java work?

Final is a keyword that is used to ...READ MORE

Aug 31, 2019 in Java by DEEPAK KUMAR GUPTA
91 views
0 votes
1 answer

Non-static method within Static method in Java

As per my knowledge, you are getting this error ...READ MORE

Sep 27, 2018 in Java by anto.trigg4
• 3,440 points
137 views
0 votes
1 answer

System.exit() method in Java

System.exit() is a method of System class ...READ MORE

Sep 27, 2018 in Java by code.reaper12
• 3,470 points
592 views
0 votes
1 answer

“Missing return statement” within if / for / while in Java

Putting a return statement in any of the ...READ MORE

Sep 26, 2018 in Java by code.reaper12
• 3,470 points
1,898 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,880 points
829 views
0 votes
1 answer

Find Oracle JDBC driver in Maven repository

Download the jar and place it in ...READ MORE

Sep 26, 2018 in Java by Daisy
• 8,080 points
1,275 views
0 votes
1 answer

What is the best Java email address validation method?

Apache Commons is generally known as a ...READ MORE

Sep 26, 2018 in Java by parth295
• 4,640 points
51 views
0 votes
1 answer

Calling remove in foreach loop in Java

To safely remove from a collection while ...READ MORE

Sep 26, 2018 in Java by sharth
• 3,370 points
964 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,880 points
792 views
0 votes
1 answer

How to convert a string representation of a hex dump to a byte array using Java?

public static byte[] hexStringToByteArray(String s) { ...READ MORE

Sep 26, 2018 in Java by sharth
• 3,370 points
252 views
0 votes
1 answer

object references an unsaved transient instance - save the transient instance before flushing

You should add cascade="all" (if using xml) ...READ MORE

Sep 26, 2018 in Java by parth295
• 4,640 points
7,213 views
0 votes
1 answer

How can we get the current location in Android?

First you need to define a LocationListener to handle ...READ MORE

Sep 25, 2018 in Java by parth295
• 4,640 points
79 views
0 votes
2 answers

How can I address the unchecked cast warnings?

@SuppressWarnings("unchecked") READ MORE

Mar 21, 2019 in Java by anonymous
2,317 views
0 votes
1 answer

Increasing the JVM memory using command line

You can adjust your JVM memory needs by ...READ MORE

Sep 24, 2018 in Java by geek.erkami
• 2,660 points
50 views
0 votes
1 answer

Unescaping HTML character entities in Java

I guess you can use this function: StringEscapeUtils.unescapeHt ...READ MORE

Sep 24, 2018 in Java by anto.trigg4
• 3,440 points
29 views
0 votes
1 answer

notify() vs. notifyAll() in Java

notify() is used to wake any thread in the wait ...READ MORE

Sep 20, 2018 in Java by code.reaper12
• 3,470 points
148 views
0 votes
1 answer

Fetching screen resolution using Java

You can fetch the screen resolution using the Toolkit.getScreenSize() method ...READ MORE

Sep 20, 2018 in Java by anto.trigg4
• 3,440 points
815 views
0 votes
1 answer

revalidate() vs repaint() in Java Swing

You need to call repaint() and revalidate() both in order ...READ MORE

Sep 19, 2018 in Java by code.reaper12
• 3,470 points
1,230 views
0 votes
1 answer

Array indexOf() in Java

You can use this indexOf() method through Arrays utility class. If the ...READ MORE

Sep 19, 2018 in Java by geek.erkami
• 2,660 points
325 views
0 votes
1 answer

Various Advice in Spring AOP

Below are the various advices available in AOP: Before: These types ...READ MORE

Sep 12, 2018 in Java by geek.erkami
• 2,660 points
82 views
0 votes
1 answer

@RequestMapping annotation in Java Spring

The @RequestMapping annotation in Spring Framework is ...READ MORE

Sep 11, 2018 in Java by code.reaper12
• 3,470 points
304 views
0 votes
1 answer

Spring AOP vs AspectJ AOP

Well, below I have listed down few ...READ MORE

Sep 10, 2018 in Java by v.liyyah
• 1,300 points
342 views
0 votes
1 answer

@Qualifier annotation in Spring Framework

When you create more than one bean ...READ MORE

Sep 10, 2018 in Java by code.reaper12
• 3,470 points
121 views
0 votes
1 answer

Executing commands with parameters in Java

Try using the below command: Runtime.getRuntime().exec(new String[]{"php","/var/www/script.php", "-m", ...READ MORE

Sep 5, 2018 in Java by geek.erkami
• 2,660 points
90 views
0 votes
1 answer

Java anonymous code blocks

The anonymous code blocks in Java are ...READ MORE

Sep 5, 2018 in Java by anto.trigg4
• 3,440 points
48 views
0 votes
1 answer

How to download a file from spring controllers?

@RequestMapping(value = "/files/{file_name}", method = RequestMethod.GET) public void ...READ MORE

Sep 4, 2018 in Java by code.reaper12
• 3,470 points
257 views
0 votes
1 answer

SuppressWarnings (“unchecked”) in Java

@SuppressWarnings("unchecked") is used when Java generics just don't ...READ MORE

Sep 4, 2018 in Java by anto.trigg4
• 3,440 points
103 views
0 votes
1 answer

Bean life cycle in Spring Bean Factory Container

Bean life cycle in Spring Bean Factory ...READ MORE

Aug 29, 2018 in Java by code.reaper12
• 3,470 points
641 views
0 votes
1 answer

Add jars to maven 2 build class path without installing them?

wn voteA quick&dirty batch solution (based on Alex's answer): libs.bat @ECHO ...READ MORE

Aug 29, 2018 in Java by samarth295
• 2,190 points
47 views
0 votes
1 answer

Constructor injection vs Setter injection in Spring Framework

Here, I have listed down few differences. ...READ MORE

Aug 29, 2018 in Java by anto.trigg4
• 3,440 points
471 views
0 votes
1 answer

Generate UML diagrams from Java code?

You could also give the netbeans UML ...READ MORE

Aug 29, 2018 in Java by samarth295
• 2,190 points
157 views
0 votes
2 answers

How to check if a string has only letters

You could probably use Java 8 lambda ...READ MORE

Aug 30, 2019 in Java by Karan
• 7,520 points
51 views
0 votes
1 answer

How to calculate the interval between 2 dates

The following code might be helpful: public static ...READ MORE

Aug 29, 2018 in Java by bug_seeker
• 15,390 points
48 views
0 votes
1 answer

Enums be subclassed to add new elements?

I suggest you take the other way ...READ MORE

Aug 28, 2018 in Java by parth295
• 4,640 points
35 views
0 votes
1 answer

Simple HTTP server in Java using only Java SE API

You can write a pretty simple embedded Jetty Java ...READ MORE

Aug 28, 2018 in Java by parth295
• 4,640 points
368 views
0 votes
2 answers

How do we convert only the second letter of every word in a string to uppercase ?

The following code will perform your desired ...READ MORE

Aug 28, 2018 in Java by curious
• 560 points
101 views
+12 votes
3 answers

How do I set or change the PATH system variable?

First make sure you have installed JDK ...READ MORE

Aug 28, 2018 in Java by slayer
• 29,260 points
127 views
+1 vote
1 answer

How do I do a HTTP GET?

If you don't want to use external ...READ MORE

Aug 28, 2018 in Java by Neha
• 6,280 points
35 views
0 votes
1 answer

How to create a temporary directory/folder in java?

If you are using JDK 7 use ...READ MORE

Aug 28, 2018 in Java by Frankie
• 9,810 points
2,368 views
+1 vote
1 answer

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

From Java 11 on, there's a method String::repeat that does ...READ MORE

Aug 28, 2018 in Java by Frankie
• 9,810 points
2,010 views
+1 vote
1 answer

How to calculate days between two dates?

You are making some conversions with your ...READ MORE

Aug 28, 2018 in Java by Frankie
• 9,810 points
67 views
0 votes
1 answer

Spring configuration file

A Spring configuration file is an XML ...READ MORE

Aug 27, 2018 in Java by v.liyyah
• 1,300 points
40 views
0 votes
1 answer

Types of IOC containers in Spring Framework

There are basically two types of IOC ...READ MORE

Aug 27, 2018 in Java by misc.edu04
• 1,430 points
725 views
0 votes
1 answer

Retrieve a file from a server via SFTP

Below is an example using Apache Common ...READ MORE

Aug 27, 2018 in Java by samarth295
• 2,190 points
67 views
0 votes
1 answer

Why is the Scanner skipping nextLine() after using next() or nextFoo()

public static void main(String[] args) { ...READ MORE

Aug 27, 2018 in Java by samarth295
• 2,190 points
202 views
0 votes
1 answer

What are the Foreign key constraints in Android using SQLite

You can use, Foreign key constraints with ...READ MORE

Aug 24, 2018 in Java by geek.erkami
• 2,660 points
125 views
0 votes
1 answer

Removing an Integer from a List<Integer> in Java

In Java, the method best suiting your argument ...READ MORE

Aug 24, 2018 in Java by anonymous
31 views
0 votes
2 answers

Java Security: Illegal key size or default parameters

Starting from Java 9 or 8u151, you ...READ MORE

Aug 23, 2018 in Java by parth295
• 4,640 points
1,849 views