Saraswat World

What is ASCII Code?

What is ASCII Code?

JAVA INTERVIEW QUESTIONS

ASCII stands for American Standard code for Information Interchange. ASCII character range is 0 to 255.We canโ€™t add more characters to the ASCII Character set. ASCII character set supports only English. That13is the reason, if we see C language we can write c language only in English we canโ€™t write in otherlanguages because it uses […]

What is difference between length and length() method in java

What is difference between length and length() method in java

JAVA INTERVIEW QUESTIONS

length() : In String class we have length() method which is used to return the number of characters instring.Ex : String str = โ€œHello Worldโ€;System.out.println(str.length());Str.length() will return 11 characters including space.length : we have length instance variable in arrays which will return the number of values or objects inarray.For example :String days[]={โ€ Sunโ€,โ€Monโ€,โ€wedโ€,โ€thuโ€,โ€friโ€,โ€satโ€};Will return 6 […]

What is constructor in java ?

What is constructor in java ?

JAVA INTERVIEW QUESTIONS

A constructor is a special method used to initialize objects in java.we use constructors to initialize all variables in the class when an object is created. As and when an objectis created it is initialized automatically with the help of constructor in java.We have two types of constructorsDefault ConstructorParameterized ConstructorSignature : public classname(){}Signature : public […]

Why main() method is public, static and void in java ?

Why main() method is public, static and void in java ?

JAVA INTERVIEW QUESTIONS

public : โ€œpublicโ€ is an access specifier which can be used outside the class. When main method is declaredpublic it means it can be used outside class.static : To call a method we require object. Sometimes it may be required to call a method without thehelp of object. Then we declare that method as static. […]

What is encapsulation ?

What is encapsulation ?

JAVA INTERVIEW QUESTIONS

The process of wrapping or putting up of data in to a single unit class and keeps data safe from misuse is called encapsulation . Through encapsulation we can hide and protect the data stored in java objects. Java supports encapsulation through access control. There are four access control modifiers in java public , private, […]

What is method in java ?

What is method in java ?

JAVA INTERVIEW QUESTIONS

It contains the executable body that can be applied to the specific object of the class.Method includes method name, parameters or arguments and return type and a body of executable code.Syntax : type methodName(Argument List){}ex : public float add(int a, int b, int c)methods can have multiple arguments. Separate with commas when we have multiple […]

What is a class in Java?

What is a class in Java?

JAVA INTERVIEW QUESTIONS

Classes are fundamental or basic unit in Object Oriented Programming . A class is kind of blueprint or template for objects. Class defines variables, methods. A class tells what type of objects we are creating. For example take Department class tells us we can create department type objects. We can create any number of department […]

What is the difference between this() and super() in java ?

What is the difference between this() and super() in java ?

JAVA INTERVIEW QUESTIONS

this() is used to access one constructor from another with in the same class while super() is used to access superclass constructor. Either this() or super() exists it must be the first statement in the constructor.

What is bytecode in java ?

What is bytecode in java ?

JAVA INTERVIEW QUESTIONS

When a javac compiler compiler compiles a class it generates .class file. This .class file contains set of instructions called byte code. Byte code is a machine independent language and contains set of instructions which are to be executed only by JVM. JVM can understand this byte codes.

What is JIT compiler ?

What is JIT compiler ?

JAVA INTERVIEW QUESTIONS

JIT compiler stands for Just in time compiler. JIT compiler compiles byte code in to executable code . JIT is a part of JVM . JIT cannot convert complete java program in to executable code it converts as and when it is needed during execution.

What is method overloading in java ?

What is method overloading in java ?

JAVA INTERVIEW QUESTIONS

A class having two or more methods with same name but with different arguments then we say that those methods are overloaded.Static polymorphism is achieved in java using method overloading.Method overloading is used when we want the methods to perform similar tasks but with different inputs or values.When an overloaded method is invoked, java first […]

Why java is platform independent?

Why java is platform independent?

JAVA INTERVIEW QUESTIONS

The most unique feature of java is platform independent. In any programming language source code is compiled in to executable code . This cannot be run across all platforms. When javac compiles a java program it generates an executable file called .class file. Class file contains byte codes. Byte codes are interpreted only by JVMโ€™s […]

What is the difference between abstract class and interface ?

What is the difference between abstract class and interface ?

JAVA INTERVIEW QUESTIONS

Abstract Class VS Interface Sr. Abstract Class Interface 1 Abstract class can contain abstract methods, concrete methods or both Interface contains only abstract methods 2 Except private we can have any access specifier for methods in abstract class. Access Specifiers for methods in interface must be public 3 Except private variables can have any access […]

Difference between method overloading and method overriding in java ?

Difference between method overloading and method overriding in java ?

JAVA INTERVIEW QUESTIONS

Method Overloading VS Method Overriding Sr. Method Overloading Method Overriding 1 Method Overloading occurs within the same class Method Overriding occurs between two classes superclass and subclass 2 Since it involves with only one class inheritance is not involved. Since method overriding occurs between superclass and subclass inheritance is involved. 3 In overloading return type […]

What is super keyword in java ?

What is super keyword in java ?

JAVA INTERVIEW QUESTIONS

Variables and methods of super class can be overridden in subclass . In case of overriding , a subclass object call its own variables and methods. Subclass cannot access the variables and methods of superclass because the overridden variables or methods hides the methods and variables of super class. But still java provides a way […]

What is method overriding in java ?

What is method overriding in java ?

JAVA INTERVIEW QUESTIONS

If we have methods with same signature (same name, same signature, same return type) in super class and subclass then we say subclass method is overridden by superclass. When to use overriding in java If we want same method with different behavior in superclass and subclass then we go for overriding. When we call overridden […]

How to call one constructor from the other constructor ?

How to call one constructor from the other constructor ?

JAVA INTERVIEW QUESTIONS

With in the same class if we want to call one constructor from other we use this() method. Based on the number of parameters we pass appropriate this() method is called. Restrictions for using this method : 1)this must be the first statement in the constructor 2)we cannot use two this() methods in the constructor

What are static blocks and static initializers in Java?

What are static blocks and static initializers in Java?

JAVA INTERVIEW QUESTIONS

Static blocks or static initializers are used to initialize static fields in java. We declare static blocks when we want to initialize static fields in our class. Static blocks gets executed exactly once when the class is loaded. Static blocks are executed even before the constructors are executed

JAVA INTERVIEW QUESTIONS

JAVA INTERVIEW QUESTIONS

JAVA INTERVIEW QUESTIONS

JAVA INTERVIEW QUESTIONS

HOW TO CREATE A DATABASE IN SQL?

HOW TO CREATE A DATABASE IN SQL?

Knowledge