Posts

Java Interview Preparation Q1 to Q5

  Q1) Explain the concept of OOP and its principles. Object-Oriented Programming System (OOPS) is a programming paradigm based on the concept of "objects", which can contain data and code to manipulate that data. The four main principles of OOP are: Encapsulation : Binding data (variables) and methods (functions) that operate on the data into a single unit or class. Inheritance : Mechanism by which one class can inherit properties and methods from another class, promoting code reuse. Polymorphism : Ability of different classes to be treated as instances of the same class through a common interface, often achieved through method overriding and overloading. Abstraction : Hiding complex implementation details and showing only the necessary features of an object. Q2) What are the differences between abstract classes and interfaces? Abstract Class: Can have both abstract methods (without implementation) and concrete methods (with implementation). Can have member variables. Can ...

Java Notes

1) What all datatypes you know in java? ->  Data type specify the size and value that can be store in variable.     DataType are divided into two group :    - Primitive datatypes include byte,short,int,long,float,double and char.    - Non Primitive datatypes include String,Arrays,Classes and Interfaces.ss 2) Can you give size required for each datatype? ->      DataType   Size   Description    -byte     1 byte       Stores whole numbers from -128 to 127    -short     2 bytes       Stores whole numbers from -32,768 to 32,767    -int     4 bytes       Stores whole numbers from -2,147,483,648 to 2,147,483,647    -long     8 bytes       Stores whole numbers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807    -float     4 bytes  ...