Can we use String in switch case?
Yes, in Java 7 String can be used in switch case.
equals() does in String class?
equals() method compares the content/data of two String object whereas
“==” checks whether reference of two objects are same or not.
How can we convert String to Integer?
String value can be converted to Integer using parseInt() method:-
Integer demo = Integer.parseInt(“10”);
Note :- If String provided as parameter is not an numeric value, it throws
What is difference between
length() in Java?
length() is a method for a String class whereas length is a property used to check number of element only for array.
Can we create daemon thread?
Yes, we can create daemon thread using setDaemon(true) method.
How to check whether any thread is dameon or not?
You can check any theread is daemon or not using isDaemon() method.
Explain Daemon thread.
Daemon thread in java is a service provider thread that provides services to user thread. It’s life depends upon user threads. When all user threads terminate, JVM terminates this thread automatically.
What are the OOPs features provided by Java?
The OOPs features provided by Java are:-
Define abstraction in Java.
Abstraction is the concept of hiding the implementation details and exposing only the required essential characteristics and behavior.
Abstraction in java is achieved using interface and abstract classes.