Trending questions in Java

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,630 points
291 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,110 points
279 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,630 points
237 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,640 points
178 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,640 points
176 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,640 points
132 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,630 points
114 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,640 points
655 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
78 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,640 points
197 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
912 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,640 points
215 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
263 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,640 points
223 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,170 points
279 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
140 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,573 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,500 points
170 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,630 points
602 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,350 points
658 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,350 points
682 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,350 points
333 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,640 points
520 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,110 points
304 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,350 points
128 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,110 points
907 views
0 votes
1 answer

How can a war file be deployed in Tomcat 7?

You can access your application from: http://localhost:8080/sample Deploying ...READ MORE

Apr 20, 2018 in Java by sophia
• 1,400 points
1,310 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,170 points
273 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,640 points
261 views
0 votes
1 answer

Sorting an ArrayList in Java

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

May 4, 2018 in Java by geek.erkami
• 2,680 points
656 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
656 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,630 points
130 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
91 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,500 points
318 views
0 votes
1 answer

How to reverse an int array in Java?

for(int i = 0; i < Data.length ...READ MORE

May 11, 2018 in Java by Akrati
• 3,170 points
293 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
1,266 views
0 votes
1 answer

Are arrays equivalent to objects in Java ?

Yes; the Java Language Specification writes: In the Java ...READ MORE

May 10, 2018 in Java by Rishabh
• 3,640 points
296 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,350 points
245 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,350 points
240 views
0 votes
1 answer

Convert String type to byte[] in Java

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

May 8, 2018 in Java by Rishabh
• 3,640 points
262 views
0 votes
1 answer

Purpose of “String args[]” in the “psvm” of Java

Let me give you the complete explanation ...READ MORE

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

In which class is the "length" property of array defined ?

It's defined in the Java language specification: The members ...READ MORE

May 8, 2018 in Java by Rishabh
• 3,640 points
253 views
0 votes
1 answer

Converting String and Float Data-types

Using Java’s Float class. float f = Float.parseFloat("25"); String s = ...READ MORE

May 9, 2018 in Java by developer_1
• 3,310 points
168 views
0 votes
1 answer

Need for finalize() in Java

finalize() is a method called by the ...READ MORE

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

Perform "Switch-case" on String in Java

Switches based on integers can be optimized ...READ MORE

May 8, 2018 in Java by Rishabh
• 3,640 points
199 views
0 votes
1 answer

How do I join 2 lists

This is not a simpler method, but ...READ MORE

May 10, 2018 in Java by sharth
• 3,350 points
100 views
0 votes
1 answer

What is the difference between Runnable and extends Thread

Runnable is the preferred way to create ...READ MORE

Apr 30, 2018 in Java by sharth
• 3,350 points
445 views
0 votes
1 answer

Difference between String.equals() and ==

Though both are used for comparison, but the ...READ MORE

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

How to calculate the difference between two date instances in Java?

You can use Joda Time Library. Interval i ...READ MORE

May 4, 2018 in Java by Parth
• 4,630 points
261 views
0 votes
1 answer

How can I create an executable JAR with dependencies using Maven?

<build> <plugins> <plugin> ...READ MORE

Apr 26, 2018 in Java by sophia
• 1,400 points
570 views