What is the difference between instanceof and isInstance?

1. What is the difference between instanceof and isInstance?
instanceof is used to check to see if an object can be cast into a specified type without throwing a cast class exception. isInstance() determines if the specified object is assignment compatible with the object represented by this Class.

2. Can applets communicate with each other?
Applets may communicate with other applets running in the same virtual machine. If the applets are of the same class, they can communicate via shared static variables.

3. What are wrapper classes? Why do we need wrapper classes?
Java provides specialized classes corresponding to each of the primitive data types. These are called wrapper classes. They are e.g. Integer, Character, Double etc.

4. What are the usages of Java packages?
It helps resolve naming conflicts when different packages have classes with the same names. This also helps you organize files within your project. For example: java.io package do something related to I/O and java.net package do something to do with network and so on.

Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: