What is the difference between exception and error?-

?– The exception class defines mild error conditions that your program encounters. Exceptions can occur when trying to open the file, which does not exist, the network connection is disrupted, operands being manipulated are out of prescribed ranges, the class file you are interested in loading is missing. The error class defines serious error conditions … Read more

What is the difference between Array and vector?-

Array is a set of related data type and static whereas vector is a growable array of objects and dynamic. In Java, both arrays and vectors are used to store and manipulate collections of elements. However, there are some key differences between them: Data Type: Array: An array can only store elements of the same … Read more

What is the difference between String and String Buffer

?– a) String objects are constants and immutable whereas StringBuffer objects are not. b) String class supports constant strings whereas StringBuffer class supports growable and modifiable strings. In Java, String and StringBuffer are both classes that represent sequences of characters, but there are key differences between them. Immutability: String: Objects of the String class are … Read more

Can you have an inner class inside a method and what variables can you access?-

?– Yes, we can have an inner class inside a method and final variables can be accessed. Yes, in Java, you can have an inner class inside a method. This type of inner class is known as a local inner class. Local inner classes are defined within the body of a method, and they have … Read more

What is the difference between abstract class and interface

a) All the methods declared inside an interface are abstract whereas abstract class must have at least one abstract method and others may be concrete or abstract. b) In abstract class, key word abstract must be used for the methods whereas interface we need not use that keyword for the methods. c) Abstract class must … Read more