Trending questions in Java

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,580 points
105 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
449 views
0 votes
1 answer

How to calculate method execution time in Java ?

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

May 24, 2018 in Java by Rishabh
• 3,580 points
415 views
0 votes
2 answers

How to create a 2-D array in java?

int[][] multi = new int[5][]; multi[0] = new ...READ MORE

Jul 16, 2018 in Java by Daisy
• 8,090 points
117 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
157 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,890 points
138 views
0 votes
2 answers

How can we remove an element from an array in Java?

You can use ArrayUtils class remove method which ...READ MORE

May 24, 2018 in Java by UshaK
385 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
164 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,090 points
158 views
0 votes
1 answer

The best way to filter a Java Collection?

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

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

Unexpected result on Subtracting Times

ou've encountered a local time discontinuity: When local standard ...READ MORE

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

get a class instance of generics type T

The short answer is, that there is ...READ MORE

May 28, 2018 in Java by Parth
• 4,640 points
113 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,150 points
420 views
0 votes
1 answer

Use of Static Keyword in a Class

It means that there is only one ...READ MORE

May 28, 2018 in Java by Rishabh
• 3,580 points
101 views
0 votes
2 answers

I'm getting following error, while i'm running code in windows xp service pack 3 with JDK 6 version.

Till you send the code, I would ...READ MORE

May 16, 2018 in Java by Meci Matt
• 9,460 points
580 views
0 votes
1 answer

Encode String to UTF-8

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

May 28, 2018 in Java by Rishabh
• 3,580 points
84 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 28, 2018 in Java by Parth
• 4,640 points
55 views
0 votes
1 answer

How to read text files from the Classpath in Java?

InputStream in = this.getClass().getClassLoader().getResourceAsStream("TextFile.txt"); InputStream in = this.getClass().getResourceAsStream("/TextFile.txt"); package ...READ MORE

May 8, 2018 in Java by Akrati
• 3,150 points
933 views
0 votes
1 answer

Formatting Double Value in Java

An alternative is to use String.format: double[] arr = ...READ MORE

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

How to implement constants in java

Here is the solution- public static final TYPE ...READ MORE

May 28, 2018 in Java by sophia
• 1,400 points
33 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 24, 2018 in Java by Rishabh
• 3,580 points
100 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,580 points
48 views
0 votes
1 answer

What is a StackOverflow Error

Parameters and local variables are allocated on ...READ MORE

May 21, 2018 in Java by Parth
• 4,640 points
209 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,580 points
127 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,470 points
111 views
0 votes
1 answer

How can we get file extension in Java?

To get the file extension, we can ...READ MORE

May 8, 2018 in Java by Parth
• 4,640 points
753 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,150 points
132 views
0 votes
1 answer

Working of post increment operator in Java

Well, I think the confusion is because ...READ MORE

May 23, 2018 in Java by geek.erkami
• 2,680 points
72 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,580 points
419 views
0 votes
1 answer

How to retrieve current stack trace?

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

May 16, 2018 in Java by code.reaper12
• 3,470 points
338 views
0 votes
1 answer

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

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

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

How to remove ‘char’ from a String?

Hi...here you can try using the overloaded ...READ MORE

May 21, 2018 in Java by code.reaper12
• 3,470 points
73 views
0 votes
1 answer

Implement Tree(Datastructure) in Java

I wrote a small "TreeMap" class based ...READ MORE

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

How does omitting curly braces in Java program, effect the code ?

Using braces makes the code more maintainable ...READ MORE

May 14, 2018 in Java by Rishabh
• 3,580 points
248 views
0 votes
1 answer

How can I make the return type of a method generic?

First of all, define callFriend: public <T extends ...READ MORE

May 18, 2018 in Java by sharth
• 3,370 points
65 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
164 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,580 points
1,298 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
347 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,580 points
321 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
407 views
0 votes
1 answer

What is Java Enterprise Edition ?

Is Java EE just a specification? What ...READ MORE

May 14, 2018 in Java by Rishabh
• 3,580 points
171 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,090 points
94 views
0 votes
1 answer

How can I get Key from their respective Values

public class NewClass1 { ...READ MORE

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

Replacing a String with a character

Yes, you are missing out on a ...READ MORE

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

How to get the number of digits in an int?

You can find out the length of ...READ MORE

May 14, 2018 in Java by Akrati
• 3,150 points
108 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
1,179 views
0 votes
1 answer

Comparable vs Comparator in Java

I think you are not alone who is ...READ MORE

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

HashMap vs LinkedHashMap vs TreeMap

Hi, there is no as such difference ...READ MORE

May 4, 2018 in Java by v.liyyah
• 1,300 points
438 views
0 votes
1 answer

Can Abstract Class have a Constructor?

Yes, an abstract class can have a ...READ MORE

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

What is ArrayIndexOutOfBoundsException ?

If You check System.out.print(names.length); you will get 3 ...READ MORE

May 11, 2018 in Java by sharth
• 3,370 points
148 views