๐Ÿ“ƒDAY 2:- Basic Java Interview Question for freshers๐Ÿ“ƒ

Kunal Gupta Engineer
3 min readJun 15, 2024

๐Ÿ‘‰ 10) What is operator overloading?

Operator overloading is a function where different operators are applied and depends on the arguments. Operator,-,* can be used to pass through the function, and it has its own precedence to execute

๐Ÿ‘‰11) What is an abstract class?

An abstract class is a class which cannot be instantiated. Creation of an object is not possible with an abstract class, but it can be inherited. An abstract class can contain only an Abstract method. Java allows only abstract method in abstract class while other languages allow non-abstract method as well.

๐Ÿ‘‰12) What is a ternary operator?

The ternary operator is said to be an operator which takes three arguments. Arguments and results are of different data types, and it depends on the function. The ternary operator is also called a conditional operator.

๐Ÿ‘‰13) What is the use of finalize method?

Finalize method helps to perform cleanup operations on the resources which are not currently used. Finalize method is protected, and it is accessible only through this class or by a derived class.

๐Ÿ‘‰14) What are the different types of arguments?

A parameter is a variable used during the declaration of the function or subroutine, and arguments are passed to the function body, and it should match with the parameter defined. There are two types of Arguments.

Call by Value โ€” Value passed will get modified only inside the function, and it returns the same value whatever it is passed into the function.

Call by Reference โ€” Value passed will get modified in both inside and outside the functions and it returns the same or different value.

๐Ÿ‘‰15) What is the super keyword?

The super keyword is used to invoke the overridden method, which overrides one of its superclass methods. This keyword allows to access overridden methods and also to access hidden members of the superclass.

It also forwards a call from a constructor, to a constructor in the superclass.

๐Ÿ‘‰16) What is method overriding?

Method overriding is a feature that allows a subclass to provide the implementation of a method that overrides in the main class. It will override the implementation in the superclass by providing the same method name, same parameter, and same return type.

๐Ÿ‘‰17) What is an interface?

An interface is a collection of an abstract method. If the class implements an interface, it thereby inherits all the abstract methods of an interface.

Java uses Interface to implement multiple inheritances.

๐Ÿ‘‰18) What is exception handling?

An exception is an event that occurs during the execution of a program. Exceptions can be of any type โ€” Runtime exception, Error exceptions. Those exceptions are adequately handled through exception handling mechanism like try, catch, and throw keywords.

๐Ÿ‘‰19) What are tokens?

A compiler recognizes a token, and it cannot be broken down into component elements. Keywords, identifiers, constants, string literals, and operators are examples of tokens

20) What are sealed modifiers?

Sealed modifiers are the access modifiers where the methods can not inherit it. Sealed modifiers can also be applied to properties, events, and methods. This modifier cannot be used to static members.

https://www.linkedin.com/groups/13045010

www.linkedin.com/in/kunal-gupta-a44a49303

--

--

Kunal Gupta Engineer

Data Analytics Expert | Turning Data into Insights | Driving Business Growth | Analyzing Trends for Success | Passionate about Data-driven Decision Making ||