Java String Pool

Hi, Please confirm.. I face this question a lot in my interviews.

How many object of string objects are created.

Java Exception tutorial: understand try catch throw

Suppose we have a method DoSomething() will read user input and the input should be a number. If user did not input a number, the method fail to finish its job, so the other code rely on the job should not execute and program should do something about it like show a message to the user, in software programming .

How the interface find its implementation in Java

I always have the question: How the interface find its implementation ? In the calling code we always declare object with the interface name, Never need to declare the implementation class. We never explicitly tell the compiler which implementation to use.

The answer is , compiler don't know which implementation to use. When you declare a interface , there is no instance created, you have to new something and assign that instance to the interface. And the instance can be anything that implement the interface.

The answer is , compiler don't know which implementation to use. When you declare a interface , there is no .

The question mark in extends declaration

In java extends declaration syntax we often see something like this:

The question mark also show up on other place, inside an angle bracket. It means any class, its a wildcard. Its the Generic of Java. It called bounded wildcard.

What is immutable object in Java?

An immutable object in Java is the object that can not be changed after it is initialized ... . For example String object is immutable because you can not change String object's content ... another object "World" and assign the reference to str variable. Being immutable is a design choice ... immutable collection. [Why use immutable object?] >They are thread safe, because their state
Previous Page 1 ... 26 27