Trending questions in Java

0 votes
2 answers

Integer to String conversion in java

We can do this in 2 ways: String ...READ MORE

Jul 28, 2018 in Java by samarth295
• 2,220 points
1,189 views
0 votes
1 answer

How to calculate method execution time in Java ?

Use the following code : new Timer(""){{ ...READ MORE

May 25, 2018 in Java by Rishabh
• 3,620 points
1,689 views
0 votes
1 answer

What is ?: this operator called in java ? how dose it function?

? :  is the Conditional operator and is ...READ MORE

Jun 11, 2018 in Java by sophia
• 1,400 points
907 views
0 votes
2 answers

What is the syntax to initialize an array?

Rather than learning un-Official websites learn from ...READ MORE

Aug 2, 2018 in Java by samarth295
• 2,220 points
993 views
0 votes
1 answer

Which is the best GUI designer for Eclipse?

Windows Builder Pro is the best GUI ...READ MORE

May 21, 2018 in Java by Akrati
• 3,190 points
1,775 views
0 votes
1 answer

Serializable interface in Java

Serializable is a marker interface that has ...READ MORE

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

Decompiling Java Class Files

There are a few decompilers out there... ...READ MORE

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

Can quotes be added in a java string.how?

In Java, you can escape quotes with \: String ...READ MORE

Jun 14, 2018 in Java by Akrati
• 960 points
693 views
0 votes
1 answer

Encode String to UTF-8

String objects in Java use the UTF-16 ...READ MORE

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

What is the difference between package private, public, protected?

Modifier Class Package Subclass World Public Y Y Y Y Protected Y Y Y N No modifier Y Y N N private Y N N N   Public: Any package, any class accessibility is ...READ MORE

May 24, 2018 in Java by Parth
• 4,640 points
1,577 views
0 votes
1 answer

Does a 32-bit byte code work in 64-bit JVM?

Yes, Java bytecode (and source code) is ...READ MORE

Jun 5, 2018 in Java by sophia
• 1,400 points
1,042 views
+1 vote
1 answer

How can we resolve java.lang.OutOfMemoryError in Java?

Work with smaller batches of HashMap Objects ...READ MORE

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

Why is char[] preferred over a string?

Strings are immutable. That means once you've ...READ MORE

Jun 14, 2018 in Java by scarlett
• 1,290 points
666 views
0 votes
1 answer

How can we upload the files using JSP/ Servlets in Java?

<form action="upload" method="post" enctype="multipart/form-data"> ...READ MORE

Jun 8, 2018 in Java by Sushmita
• 6,920 points
873 views
0 votes
2 answers

How to test that an array contains a certain value?

public static final String[] VALUES = new ...READ MORE

Jul 17, 2018 in Java by Sushmita
• 6,920 points
1,103 views
0 votes
1 answer

How to initialize multi-dimensional array in java?

A multidimensional array in Java is really an array ...READ MORE

Jun 6, 2018 in Java by sophia
• 1,400 points
936 views
0 votes
1 answer

What is the difference == and equals() in Java?

Both the answers (Syntaxes) are correct. If ...READ MORE

Jun 5, 2018 in Java by Akrati
• 3,190 points
984 views
0 votes
1 answer

Following error is occurring "Can't start Eclipse - Java was started but returned exit code=13"

There are combinations of Operating System, JDK ...READ MORE

Apr 19, 2018 in Java by Rishabh
• 3,620 points
2,977 views
0 votes
1 answer

How to decode Base64 data in Java?

Java SE has the parser called JAXB, ...READ MORE

May 30, 2018 in Java by sharth
• 3,370 points
1,216 views
0 votes
1 answer

How to retrieve current stack trace?

Yes, in Java we do have a ...READ MORE

May 17, 2018 in Java by code.reaper12
• 3,500 points
1,800 views
0 votes
1 answer

Fixing java.lang.UnsupportedClassVersionError in Java

To fix the exception/ error, you should ...READ MORE

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

Why the main() method in Java is always static?

As you might know, static here is ...READ MORE

May 9, 2018 in Java by geek.erkami
• 2,680 points
2,099 views
0 votes
1 answer

How can two strings be concatenated in java?

You can concatenate Strings using the + operator: System.out.println("Your number ...READ MORE

Jun 6, 2018 in Java by Daisy
• 8,140 points
823 views
0 votes
1 answer

How can we nicely format a floating number into String by removing unnecessary zeros?

public static String fmt(double d) { if(d ...READ MORE

Jun 6, 2018 in Java by Parth
• 4,640 points
821 views
0 votes
1 answer

How to use pairs or 2-tuples in java?

You can refer the following code: public class ...READ MORE

Jun 7, 2018 in Java by Daisy
• 8,140 points
764 views
0 votes
1 answer

What are preparedstatements? How do they differ from statements?

Statement is used for static queries like ...READ MORE

Jun 8, 2018 in Java by Daisy
• 8,140 points
745 views
0 votes
1 answer

How to connect Java program to the MySQL database?

You can connect your Java code with ...READ MORE

May 11, 2018 in Java by Parth
• 4,640 points
1,913 views
0 votes
1 answer

Sorting an ArrayList in Java

You can easily do this by simply ...READ MORE

May 5, 2018 in Java by geek.erkami
• 2,680 points
2,180 views
0 votes
1 answer

Java Static nested class

Hi, to understand their usage, you must ...READ MORE

Jun 8, 2018 in Java by v.liyyah
• 1,300 points
703 views
0 votes
1 answer

How to encode data using Base64 in Java?

import org.apache.commons.codec.binary.Base64; We can not use sun.* packages ...READ MORE

May 30, 2018 in Java by Sushmita
• 6,920 points
1,062 views
0 votes
1 answer

How to run the JAR files in windows?

Following are the steps to run the ...READ MORE

May 28, 2018 in Java by Parth
• 4,640 points
1,141 views
0 votes
1 answer

How can one day be added to a date?

One possible solution could be using calendar ...READ MORE

Jun 8, 2018 in Java by Daisy
• 8,140 points
626 views
0 votes
1 answer

How to split Strings by space in Java ?

You can use split() method. str = "Hello ...READ MORE

May 16, 2018 in Java by sharth
• 3,370 points
1,574 views
0 votes
1 answer

Why java have transient fields?

Variables may be marked transient to indicate that they ...READ MORE

May 28, 2018 in Java by Daisy
• 8,140 points
983 views
0 votes
1 answer

How to read and write on an excel files?

Follow these steps: Write: public class User { ...READ MORE

May 15, 2018 in Java by Rishabh
• 3,620 points
1,539 views
0 votes
1 answer

How can we resolve ClassNotFoundException in Java?

Your classpath is broken. Depending on how you ...READ MORE

May 22, 2018 in Java by Akrati
• 3,190 points
1,236 views
0 votes
1 answer

Is it possible to run a java program from command line on windows?How?

  Let's say your file is in C:\myprogram\ Run ...READ MORE

Apr 18, 2018 in Java by sophia
• 1,400 points
2,682 views
0 votes
1 answer

what does javabean actually means?

A JavaBean is just a standard All properties ...READ MORE

Jun 7, 2018 in Java by anonymous
646 views
0 votes
1 answer

How to fix the error failed to load the JNI shared Library?

You need these three things : 64-bit OS 64-bit ...READ MORE

Apr 19, 2018 in Java by sophia
• 1,400 points
2,583 views
0 votes
1 answer

How does contains() method work in evaluating objects?

Generally you should also override hashCode() each time you ...READ MORE

May 25, 2018 in Java by Rishabh
• 3,620 points
1,015 views
0 votes
1 answer

What does Java option -Xmx stand for?

-Xmxn: It specifies the maximum size, in bytes, ...READ MORE

May 9, 2018 in Java by sharth
• 3,370 points
1,717 views
0 votes
1 answer

What is the concept of Immutability for strings in Java ? Why are strings immutable ?

According to Effective Java, chapter 4, page 73, ...READ MORE

May 11, 2018 in Java by Rishabh
• 3,620 points
1,601 views
0 votes
1 answer

How to clone ArrayList and also clone its contents?

Iterate on the items, and clone them ...READ MORE

Jun 5, 2018 in Java by Akrati
• 3,190 points
550 views
0 votes
1 answer

What is the 'instanceof' operator used for in Java?

It's an operator that returns true if ...READ MORE

May 23, 2018 in Java by Rishabh
• 3,620 points
1,067 views
0 votes
1 answer

The best way to filter a Java Collection?

 this problem is solved using streams and ...READ MORE

May 29, 2018 in Java by Parth
• 4,640 points
831 views
0 votes
1 answer

parse int value from a char

Check Character.getNumericValue(char). String element = "el7"; int x = Character.getNumericValue(element.charAt(2)); System.out.println("x=" ...READ MORE

May 29, 2018 in Java by Parth
• 4,640 points
770 views
0 votes
1 answer

How to download and save a file from Internet using Java?

public void saveUrl(final String filename, final String ...READ MORE

May 25, 2018 in Java by Rishabh
• 3,620 points
914 views
0 votes
1 answer

Can Static methods be inherited in java?

A subclass inherits all of the public ...READ MORE

Apr 30, 2018 in Java by Daisy
• 8,140 points
1,929 views
0 votes
1 answer

Overloaded method for null in Java

The method invoked here will be the ...READ MORE

May 23, 2018 in Java by code.reaper12
• 3,500 points
907 views
0 votes
1 answer

How to set a timer in Java?

To work on timer in java, you ...READ MORE

May 16, 2018 in Java by Daisy
• 8,140 points
1,217 views