Astrea IT Services
POSCO MAHARASHTRA STEEL Interview Questions and Answers
Q1. What is a static keyword in java? Where are the static variables stored? One programmatic situation was given based on static keyword and i was asked the final output.
The static keyword in Java is used to create variables and methods that belong to the class rather than instances of the class.
Static variables are stored in the static memory area, also known as the method area or permanent generation.
Static variables are shared among all instances of a class.
Static methods can be called without creating an instance of the class.
Static variables and methods can be accessed using the class name followed by the dot operator.
A programmatic situ...read more
Q2. What is Polymorphism? Difference between Runtime and static Polymorphism with the help of a program.
Polymorphism is the ability of an object to take on many forms. Runtime polymorphism is achieved through method overriding.
Polymorphism allows objects of different classes to be treated as objects of a common superclass.
Static polymorphism is achieved through method overloading.
Runtime polymorphism is determined at runtime based on the actual type of the object.
Static polymorphism is determined at compile-time based on the number and types of arguments passed to a method.
Exam...read more
Q3. Why is String immutable ? difference between StringBuffer,String Builder and String with example ?
String is immutable because it ensures data integrity and thread safety. StringBuffer and StringBuilder are mutable alternatives.
String is immutable, meaning its value cannot be changed once created.
Immutable strings ensure data integrity and thread safety.
StringBuffer and StringBuilder are mutable alternatives to String.
StringBuffer is synchronized and thread-safe, but slower.
StringBuilder is not synchronized, faster, but not thread-safe.
Example: String name = "John"; name +...read more
Q4. what is multiple inheritance and what is multilevel inheritance?
Multiple inheritance is when a class inherits from more than one base class. Multilevel inheritance is when a class inherits from another derived class.
Multiple inheritance allows a class to inherit attributes and behaviors from multiple parent classes.
Multilevel inheritance involves a chain of inheritance where a derived class inherits from another derived class.
In multiple inheritance, conflicts may arise if two base classes have methods with the same name.
In multilevel inh...read more
Q5. What is abstract keyword? what is abstract function?
The abstract keyword is used in object-oriented programming to declare a class or method as abstract.
An abstract class cannot be instantiated and can only be used as a base for other classes.
An abstract method is a method without a body, and it must be implemented by any concrete subclass.
Abstract classes can have both abstract and non-abstract methods.
Abstract methods are used to define a common interface that all subclasses must implement.
The abstract keyword allows for the...read more
Q6. What are the main OOPs concepts?
The main OOPs concepts are encapsulation, inheritance, and polymorphism.
Encapsulation: bundling of data and methods into a single unit (class) to hide implementation details.
Inheritance: ability of a class to inherit properties and methods from another class.
Polymorphism: ability of objects of different classes to be treated as objects of a common superclass.
Q7. How does java implement multiple inheritance?
Java implements multiple inheritance through interfaces.
Java does not support multiple inheritance of classes.
Instead, it allows multiple inheritance of interfaces.
A class can implement multiple interfaces, inheriting their methods and constants.
Interfaces provide a way to achieve multiple inheritance without the complexities of class inheritance.
Example: class A implements Interface1, Interface2 { ... }
Q8. Print prime numbers between 1 to n(optimized solution)
The optimized solution to print prime numbers between 1 to n.
Start with a loop from 2 to n
For each number, check if it is divisible by any number from 2 to its square root
If it is not divisible by any number, it is a prime number and can be printed
Q9. What is an interface? is it abstract?
An interface is a contract that defines a set of methods that a class must implement. It is not abstract.
An interface provides a way to achieve multiple inheritance in Java.
It allows for loose coupling between classes.
Interfaces can have constants and default methods.
A class can implement multiple interfaces.
Interfaces are used to achieve abstraction and provide a common behavior for classes.
Top HR Questions asked in POSCO MAHARASHTRA STEEL
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month