Latest questions in Java

0 votes
1 answer

Check whether the string is palindrome or not?

You may refer the below code: public static ...READ MORE

Jul 11, 2018 in Java by Akrati
• 3,190 points
900 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
407 views
–1 vote
1 answer

What is the difference between oracle JDK and open JDK

Both OpenJDK and Oracle JDK are created ...READ MORE

Jul 10, 2018 in Java by Akrati
• 3,190 points
930 views
0 votes
1 answer

org.xml.sax.SAXParseException: How to handle this exception?

This is often caused by a white ...READ MORE

Jul 9, 2018 in Java by sharth
• 3,370 points
5,729 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,431 views
0 votes
2 answers

What is the difference between Type List and type ArrayList in Java

By List, you actually tell, that your object ...READ MORE

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

How may I programmatically determine operating system in Java?

Use the following program public class Osname {        public ...READ MORE

Jul 6, 2018 in Java by Priyaj
• 58,090 points
553 views
0 votes
2 answers

Give an example for encryption and decryption in AES using Java

getfullstring: Splashscreen.text >>> READ MORE

May 8, 2019 in Java by anonymous
6,599 views
0 votes
1 answer

Is there any way to write content of Java InputStream to an OutputStream?

org.apache.commons.io.IOUtils from Apache has a method called copy(InputStream,OutputStream).which does ...READ MORE

Jul 6, 2018 in Java by sharth
• 3,370 points
588 views
0 votes
1 answer

How can we return a JSON object from a Java Servlet?

response.setContentType("application/json"); // Get the printwriter object from response ...READ MORE

Jul 6, 2018 in Java by sharth
• 3,370 points
5,646 views
0 votes
1 answer

What is an efficient way to implement a singleton pattern in Java?

Use an enum: public enum Foo { ...READ MORE

Jul 6, 2018 in Java by Akrati
• 3,190 points
761 views
0 votes
1 answer

How to get the name of the currently executing method?

Thread.currentThread().getStackTrace() will usually contain the method you’re ...READ MORE

Jul 5, 2018 in Java by Daisy
• 8,120 points
616 views
0 votes
2 answers

C++ performance vs. Java/C#

The overhead of interpreting code is much higher than ...READ MORE

Dec 27, 2018 in Java by iangregor
• 300 points
996 views
0 votes
1 answer

Hibernate show real SQL

If you want to see the SQL ...READ MORE

Jul 5, 2018 in Java by Sushmita
• 6,910 points
834 views
0 votes
2 answers

How to left pad a string with zero in java?

String paddedString = org.apache.commons.lang.StringUtils.leftPad("129018", 10, "0") the second ...READ MORE

Aug 31, 2018 in Java by Sushmita
• 6,910 points
2,878 views
0 votes
1 answer

How to pretty print XML from Java?

Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); //initialize StreamResult ...READ MORE

Jul 4, 2018 in Java by Akrati
• 3,190 points
1,690 views
0 votes
1 answer

java.lang.UnsupportedClassVersionError: Bad version number in .class file. How to solve this?

I've learned that error messages like this ...READ MORE

Jul 4, 2018 in Java by Annie
• 240 points
741 views
0 votes
1 answer

What is the equivalent of the C++ Pair<L,R> in Java?

In a thread on comp.lang.java.help, Hunter Gratzner ...READ MORE

Jul 4, 2018 in Java by Rishabh
• 3,620 points
834 views
0 votes
1 answer

How to tell Jackson to ignore a field during serialization if its value is null?

To suppress serializing properties with null values ...READ MORE

Jul 4, 2018 in Java by Rishabh
• 3,620 points
6,845 views
0 votes
2 answers

Is there a SortedList in Java?

Since all lists are already "sorted" by ...READ MORE

Nov 2, 2018 in Java by Sushmita
• 6,910 points
4,182 views
0 votes
1 answer

Can we convert a string to hexadecimal in java

I find this to be an easy ...READ MORE

Jul 4, 2018 in Java by Akrati
• 3,190 points
3,867 views
0 votes
1 answer

How to retrieve column names from java.sql.ResultSet?

You may refer the below code: ResultSet ...READ MORE

Jul 4, 2018 in Java by sophia
• 1,400 points
2,474 views
0 votes
1 answer

Interface variable are static and final by default. Why?

Interface variables are static because Java interfaces ...READ MORE

Jul 4, 2018 in Java by Daisy
• 8,120 points
12,714 views
0 votes
1 answer

Bean Scopes in Java Spring

According to my knowledge, the Spring Framework ...READ MORE

Jul 4, 2018 in Java by geek.erkami
• 2,680 points
1,013 views
0 votes
1 answer

Annotation wiring in Spring

By default, Annotation wiring is not turned ...READ MORE

Jul 4, 2018 in Java by code.reaper12
• 3,500 points
992 views
0 votes
1 answer

Measure time elapsed in Java?

This is also a way to work ...READ MORE

Jul 4, 2018 in Java by scarlett
• 1,290 points
587 views
0 votes
1 answer

Number of lines in a file in Java

I found this an efficient way in counting ...READ MORE

Jul 4, 2018 in Java by scarlett
• 1,290 points
422 views
0 votes
1 answer

Iterating through a Collection, avoiding ConcurrentModificationException when removing in loop

You can either use the iterator directly ...READ MORE

Jul 3, 2018 in Java by Rishabh
• 3,620 points
1,151 views
0 votes
1 answer

Continue Keyword in Java

continue is kind of like goto. Are you familiar ...READ MORE

Jul 3, 2018 in Java by Rishabh
• 3,620 points
371 views
+29 votes
3 answers

How can we set java.library.path in Eclipse?

Go into the library settings for your ...READ MORE

Jul 3, 2018 in Java by sharth
• 3,370 points
21,078 views
0 votes
1 answer

How to get a platform-dependent new line character in Java?

If you are using Java 1.5 or ...READ MORE

Jul 3, 2018 in Java by Akrati
• 3,190 points
680 views
0 votes
1 answer

Difference between JSF, Servlet and JSP?

Servlet - it's java server side layer. JSP ...READ MORE

Jul 3, 2018 in Java by samarth295
• 2,220 points
1,304 views
0 votes
2 answers

How do I get the size of a java.sql.ResultSet?

You could probably do rows-count. ResultSet rs = ...READ MORE

Aug 22, 2019 in Java by Sirajul
• 59,230 points
12,418 views
0 votes
2 answers

How to sort array in descending order

there are some traditional ways that you ...READ MORE

Jul 4, 2018 in Java by Priyaj
• 58,090 points
942 views
0 votes
1 answer

How can we format float to n decimal places ?

You may pass the float value: String.format("%.2f", floatVal); READ MORE

Jul 2, 2018 in Java by sophia
• 1,400 points
1,152 views
0 votes
1 answer

A Java collection of value pairs? (tuples?)

The Pair class is one of those ...READ MORE

Jul 2, 2018 in Java by sharth
• 3,370 points
2,207 views
0 votes
1 answer

How to get the Generic type of class at run time?

public class GenericClass<T> { ...READ MORE

Jul 2, 2018 in Java by Akrati
• 3,190 points
641 views
0 votes
0 answers

How to populate a ListView using an ArrayList?

I want to populate the data coming ...READ MORE

Jun 30, 2018 in Java by misc.edu04
• 1,450 points
959 views
0 votes
1 answer

ThreadLocal variables usage in Java

public class Test { // ...READ MORE

Jun 30, 2018 in Java by code.reaper12
• 3,500 points
454 views
0 votes
1 answer

No appenders could be found for logger(log4j)?

Just to get you going you have ...READ MORE

Jun 29, 2018 in Java by Akrati
• 3,190 points
8,326 views
0 votes
2 answers

What is the difference between getAttribute() and getParameter() in java?

getParameter() returns http request parameters. Those passed from ...READ MORE

Aug 28, 2019 in Java by Sirajul
• 59,230 points
21,536 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,059 views
+1 vote
1 answer

What is the difference between JavaScript and Java

This quote rightly explains that 2 totally ...READ MORE

Jun 29, 2018 in Java by Daisy
• 8,120 points
588 views
0 votes
1 answer

What are Daemon threads in Java?

A daemon thread is a thread that is doing ...READ MORE

Jun 29, 2018 in Java by Daisy
• 8,120 points
552 views
0 votes
1 answer

How to configure Android SDK for finding JDK

Actual SETUP: OS: Windows 8.1 JDK file: jdk-8u11-windows-x64.exe ADT file: ...READ MORE

Jun 29, 2018 in Java by Rishabh
• 3,620 points
530 views
0 votes
1 answer

DEX decompilation in Java Sourcecode

down voteaccep It's easy Get these tools: 1) dex2jar to translate dex ...READ MORE

Jun 29, 2018 in Java by Rishabh
• 3,620 points
3,750 views
0 votes
1 answer

How to add row in JTable

To create a table: JTable table = new ...READ MORE

Jun 29, 2018 in Java by Akrati
• 960 points
2,723 views
0 votes
1 answer

Calling SOAP web services on Android using JAVA

Android does not provide any sort of ...READ MORE

Jun 28, 2018 in Java by Sushmita
• 6,910 points
2,364 views
0 votes
1 answer

How can we run the .jar file by double clicking on windows 7 (64)?

Use the following method to run the ...READ MORE

Jun 28, 2018 in Java by sharth
• 3,370 points
1,588 views
0 votes
1 answer

How can we use java property files?

You can refer the below code: Properties properties ...READ MORE

Jun 28, 2018 in Java by Akrati
• 960 points
489 views