0% found this document useful (0 votes)
42 views7 pages

Java Questions (Shambhu Patil)

The document outlines important Java questions categorized into various topics such as basic structure, tokens, variables, data types, operators, control flow statements, methods, static and non-static members, constructors, encapsulation, inheritance, polymorphism, abstraction, packages, access modifiers, object class, strings, wrapper class, exceptions, collection framework, and arrays. Each category includes multiple questions aimed at assessing knowledge and understanding of Java programming concepts. This comprehensive list serves as a study guide for individuals preparing for Java-related assessments or interviews.

Uploaded by

tathavan.mng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views7 pages

Java Questions (Shambhu Patil)

The document outlines important Java questions categorized into various topics such as basic structure, tokens, variables, data types, operators, control flow statements, methods, static and non-static members, constructors, encapsulation, inheritance, polymorphism, abstraction, packages, access modifiers, object class, strings, wrapper class, exceptions, collection framework, and arrays. Each category includes multiple questions aimed at assessing knowledge and understanding of Java programming concepts. This comprehensive list serves as a study guide for individuals preparing for Java-related assessments or interviews.

Uploaded by

tathavan.mng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Java Important Questions

13 March 2023 11:17 AM

BASIC STRUCTURE OF JAVA PROGRAM

1.Can we write a class without a main method?


2.Explain about class members?
3.what is the syntax to create a class block?
4.Why do we need the main method?
5.Explain the statements used to print data?

TOKENS

1.What is tokens and How many types are there?


2.Explain about keywords?
3.What is identifier?
4.Explain about rules of identifiers?
5.Explain about convention of identifiers?
6.What is the difference between rules and conventions of an identifier?
7.What is primitive value?
8.What is non-primitive value?
9.What is character literal?
10.What are boolean literals?
11.What is String literal?

VARIABLES AND DATATYPES

1.What is Datatype ? How many types are there?


2.What is primitive data type? How many types are there?
3.What is non-primitive data type?
4.Write the number data types in increasing order?
5.What is primitive variable?
6.What is non primitive variable?
7.Write the syntax to create primitive variables?
8.Write the syntax to create non-primitive variables?
9 .Whether the class name is a non-primitive datatype?
10.Based on the scope how many types of variables are there?
11.What is local variable? And explain about characteristics of local variable
12.Based on the type how many types of variables are there?

OPERATORS

1.What is typecasting and how many types of typecasting are there?


2.What is primitive typecasting and which are the types of primitive typecasting?
3.Expalin about widening ? Give any one example.
4.Explain about narrowing ? Give any one example.
5.Explain about typecast operator.
6.Explain about operators?
7.Based on the operands how many types of operators are there?
8.Based on the task how many types of operators are there?
9.What is operand and what is expression?
10.Explain about Arithmetic operators.
11.Explain about Assignment operators.
12.Explain about Relational Operators
13.Explain about conditional Operator
14.Explain about logical Operators.
15.Explain about Increment and Decrement Operator

CONTROL FLOW STATEMENTS

1.What is control flow statments? And how many types are there?
2.What is decision making statements ? And how many types are there?
3.Explain about if statement and give any one example
4.Explain about if else statement and give any one example
5.Explain about if else if statement and give any one example
6.Explain about switch statement and give any one example
7.What is break ? Whether break statement is optional or mandatory?
8.Can we able to write duplicate cases in switch statement?
9.What is looping statements? And how many types are there?
10.Explain about while loop and Give one example for while loop
11.Explain about do while loop and Give one example for do while loop
12.What is the difference between while loop and do while loop?
13.Explain working flow for loop

METHODS

1.What is method and what is the syntax to create a method


2.Is Access Modifiers And Modifiers are Mandatory in Methods.
3.What is Access Modifiers and Explain their types
4.What is Modifiers and which are the different types of modifiers we have?
5.What is Return Type And What we can able to Write in the position of return Type
6.Explain about Method Terminologies (Method Signature, Method Declaration and
Method definition)
7.Types of Methods Based On the Arguments
8.How to call a method ?
9.What do you mean by calling method and Called Method
10.What process will Happen When The Method is Called
11.Is Their any keyword to terminate the Execution of the method
and Transfer back the control to the caller
12.Can we call void Method inside Print Statements
13.which keyword is used to return the Promised value in return Type of Method
14.What is Actual Arguments
15.What is Formal Arguments
16.Who will call Main Method
17.Execution starts And End in which Method ?
18.Is Main Method Mandatory, what Happens When Main Method
is Not Their and if Programmer try to Compile and Run?
19.Can a programmer use string to return in return Type
20.What is The Convention for writing a method
21.is Return Type Mandatory
22.Can we have a method inside a method
23.What is dynamic read?
24.Explain the steps to read the data from the user?
25.In which package Scanner class is available?

STATIC MEMBERS

1.Explain about static.


2.Explain about static variables and their characteristics?
3.Explain about static methods and their characteristics?
4.Explain about static initializers?
5.How to access static variable within the class and outside the class?
6.How to access static method within the class and outside the class?
7.Explain about class loading process?

NON STATIC MEMBERS

1.Explain about Non static members


2.Explain about non static variables and their characteristics?
3.Explain about non static methods and their characteristics?
4.Explain about non static initializers?
5.How to access static non variable within the class and outside the class?
6.How to access static non method within the class and outside the class?
7.What is object? And What is class?
8.Explain about object loading process?
9.Explain about new Keyword

CONSTRUCTOR

1.What is constructor? What is the use of constructor?


2.What is the syntax to create a constructor?
3.Can we able to use return type of constructor ? If we use return type it will give error or not?
4.Explain about types of constructors?
5.What is the use of private constructor in java?
6.What is constructor chaining in java
7.Can we have this() and super() in the same constructor?
8.Is it possible to call a subclass constructor from a superclass constructor?
9.What is Parameterized constructor?
10.What is no argument constructor?
11.Can we have both no argument Constructor and Parameterized Constructor in the same
Class?
12.Can a constructor return any value?
13.When the compiler will create default no argument constructor?

ENCAPSULATION

1.What is Encapsulation
2.How to achieve encapsulation?
3.What is the advantage of encapsulation
4.What is data hiding?
5.How to achieve data hiding?
6.What is the use of getter and setter method ?
7.What are the advantages of data hiding?
8.WAJP to achieve data hiding.
9.Explain any one real time example for encapsulation
10.What is fully encapsulated class?

INHERITANCE

1.What is Relationship and What are the types we have?


2.What is has-A Relationship and What are the types we have?
2.Explain composition and how to achieve composition concept?
3.Explain Aggregation and how to achieve aggregation concept?
4.What is IS-A Relationship and How to achieve IS-A Relationship concept?
5.What is Inheritance and What are the types we have?
6.How to achieve IS-A relationship between two classes?
7.What is single level inheritance and WAJP to demonstrate example for single level
inheritance
8.What is Multilevel inheritance and WAJP to demonstrate example for multi level 5
inheritance
9.What is Hierarchical inheritance and WAJP to demonstrate example for Hierarchical level
inheritance
10.What is Multiple Inheritance and can we able to achieve multiple inheritance by using class.
11.Explain Diamond problem (ambiguity) ?
12.What is Hybrid Inheritance and can we able to achieve hybrid Inheritance by using class.
13.What is non primitive typecasting or derived type casting? And what are the types we have?
14.What is upcasting and what is the advantage of upcasting?
15.What is Down casting ? Can we able to achieve Down casting directly without performing
upcasting?
16.What is class cast exception? When we will get and what is the reason for that?
17.How to check whether the instance is present or not ? Explain about instanceof operator?
18.WAJP to demonstrate Non primitive typecasting

POLYMORPHISM

1.What is polymorphism and what are the types we have?


2.What is Method binding?
3.What is compile time polymorphism and how to achieve compile time polymorphism?
4.What is method overloading? WAJP for method overloading concept
5.Explain any one real time example for method overloading concept
6.What is constructor overloading? WAJP for constructor overloading concept
7.Explain method shadowing? WAJP for method shadowing concept
8.Explain variable shadowing? WAJP for variable shadowing concept
9.What is runtime polymorphism and how to achieve runtime polymorphism?
10.Explain Method Overriding and WAJP for method overriding concept
11.Expalin any one real time example for method overriding concept.
12.Explain about Final
13.What is final class ? Can we able to inherit final class?
14.What is final method ? Can we able to inherit final method? Can we able to override the
final method
15.What is final variable ? Can we able to do reinitialization for the final variable?
ABSTRACTION

1.What is abstraction?
2.How to achieve abstraction?
3.What is abstract method? What is the syntax to create abstract method
4.What is concrete method?
5.What is abstract class?
6.What is concrete class?
7.Can we able to use abstract keyword for variables?
8.Why we go for Interface?
9.Explain any one real time example for Abstraction
9.What is an interface?
10.Can we able to create object for a interface?
11.Can we able to create a constructor inside the interface?
12.Can we able to create static methods inside the interface?
13.WAJP to achieve multiple inheritance .

Packages :

1.What is package?
2.How many types of packages we have? Which are those?
3.How to access built-in packages?
4.Is it necessary to import java.lang package?
5.Explain Java.lang.Math ?

Access Modifiers:

1.What is access modifier?


2.How many types of access modifiers are there? Which are those?
3.Can we able to access private members outside the class?
4.Can we able to access protected members outside the package ? If it is possible then
explain how to access?
5.Can we able to access default members outside the package?
6.Which access modifier is having highest visibility?
7.Can we able to use private access modifier for constructor?
8.Can we able to use private access modifier for class?

Object class:

1.Explain about object class?


2.In which package object class is present?
3.How many methods are there in object class?
4.Explain about toString() ?
5.Explanu about equals() ?
6.Explain about hash Code() ?

Strings :
1.What is String ?
2.Explain about String class?
3.Explain about String Buffer?
4.Explain about StringBuilder
5.Why String class is immutable in nature?
6.Difference between String, String Buffer and String Builder?
7.Can we able to create String Buffer object without new Keyword?
8.Can we able to create String Builder object without new Keyword?
9.Can we able to create String object without new Keyword?

Wrapper class:

1.Why java is not a 100% object oriented programming language?


2.Why we go for wrapper class ? And what is wrapper class?
3.What is boxing?
4.How to achieve boxing concept?
5.What is unboxing?
6.How to achieve unboxing concept?
7.What is parsing?

Exception:

1.What is exception ? How many types are there?


2.Explain about checked exception and unchecked exception ? give any one
example for those exception
3.Explain about throwable class ? And what are the important methods present
In it?
4.What is exception handling? Explain about how to handle the exception?
5.Explint try{},catch{} and finally{} block
6.Difference between throw and throws keyword.
7.What is exception object propagation
8.WAJP to demonstrate custom exception

Collection Framework:

1.Why we go for collection framework ? What are the limitation of array?


2.What is collection framework and what are the important hierarchies we have?
3.Expain about Collection interface and what are the important methods
available in it?
4.Explain about List interface and their characteristics.
5.Explain about Array List and their characteristics.
6.Explain about LinkedList and their characteristics.
7.Difference between Array List and LinkedList
8.WAJP to convert array to list
9.WAJP to convert list to array
10.Explain about set interface and their characteristics
11.Explain about HashSet and their characteristics
12.Explain about LinkedHashSet and their characteristics.
13.Explain about TreeSet and their characteristics
14.Explain about Map interface and their characteristics.
15.Explain about HashMap and their characteristics
16.Explain about TreeMap and their characteristics
17.Explain about Hashtable and their characteristics
18.Explain about LinkedHashMap and their characteristic

Arrays:

1.WAJP to print the length and reference variable of the array


2.WAJP to store elements in an array &print all elements present in an array.
3.WAJP to get ArrayIndexOutOfBoundsException ?
4.WAJP to print ascii code for the characters present in an array.
5.WAJP to copy elements from one array to another array
6.WAJP to print elements in reverse order.
7.WAJP to reverse an Array.
8.WAJP to print odd and even index element present in an array.
9.WAJP to print odd and even element present in an array.
10.WAJP to find sum of odd and even elements present in an array.
11.WAJP to find product of odd and even elements present in an array.
12.WAJP to read elements from the user, store it and then print it.
13.WAJP to sort the elements present in an array by using Bubble Sort.
14..WAJP to search an element present in an array by using Linear Search
15.WAJP to search an element present in an array by using Binary Search
16.WAJP to swap the element present in an array.(kth swap)
17.WAJP to count the number of digits present in an array.
18.WAJP to find the first largest and first smallest element present in an array
19. I/P : a=[10,20,30,40] b=[50,60,70] O/P : res=[10,20,30,40,70,50,60]
20. I/P : a=[10,20,30,40] b=[50,60,70,80] O/P: res=[10,50,20,60,30,70,40,80]
21.WAJP for merging of two arrays.
22.WAJP to Rotate an array
23.WAJP to print to print duplicate elements present in an array
24.WAJP to count the total number of palindrome numbers present in an array.
25.WAJP to count the total number of prime numbers present in an array.
26.WAJP to count the total number of perfect numbers present in an array.
27.WAJP to remove duplicates and find nth largest and nth smallest.

You might also like