SlideShare a Scribd company logo
JAVA Interview Questions and Answers:
Can a constructor be made final?
No, thisis not possible.
staticmembersbelong to a class, but the constructor is needed to create an object. An abstract classis a
partiallyimplemented class,which containsabstract methods to be implemented in child class. final
restrictsmodification: variablesbecome constant, methodscan't be overridden, and classes can't be
inherited.
No. constructors are similar to methods,but cannot be invoked directlyby a method call. They are used
to initialize new class instances.Like methods, theymay be overloaded
What is the APK format?
The Android packaging key is compressed with classes,UI's, supportive assetsand manifest.All filesare
compressed to a single file is called APK.
APK standsfor android Application Package File(APK), it is zip file formatted packages based on the
android application code.
Android application package (APK) is the package file format used by the Android operatingsystem for
distribution and installation of mobile appsand middleware. APK filesare analogous to other software
packages such as APPXin Microsoft Windows or Deb packages in Debian-based operatingsystemslike
Ubuntu.
What do you know about Java?
Java is a high-level programminglanguage originallydeveloped bySun Microsystems and released in
1995. Java runs on a varietyof platforms, such as Windows, Mac OS, and the various versions of UNIX.
Some of the advantagesof the Java:
 The code is compiled into bytecode, it is like code once and run anywhere. It eliminatesthe need for
platform-specificversions.
 Unlike other languages,the code is very robust.
 Object-oriented language.
 The appletsrunsfaster
 Compared to C++, Java is easy to learn.
Java is an portable language which supportsobject oriented featureslike inheritance,polymorphism and
encapsulation and it is platform independent once compile and run any where with the help of JVM.IN
JVM we have native stack which is used to store non java code and it helps the programer to covert it to
java code.
What is stored procedure?
1. Stored procedure is a pre-compiled Sql statements. 2. That meansstored procedure will contain sql
statementslike SELECT, UPDATE, DELETE and so on which is alreadycompiled. Syntax: Create
procedure procedurename () As Begin { } end
A stored procedure is a bunch of SQL statementsthat are stored in the DB. The different types of stored
procedures; a) System Stored Procedures b) User Defined Stored Proceduresc) Extended Stored
Procedures.These procedureswill accept input parametersso that a single procedure can be called by
several clients. The benefits of the Stored Procedures are: - Faster Execution - Implementsmodule
programming - Minimize the networktraffic
Stored procedure is simplya set operationsperformed on table...with different conditions.
what is boolean?
Boolean valuesare the two constant objects True and False, are used to represent truth values(other
valuescan also be considered false or true).
In numericcontexts (for example, when used as the argument to an arithmeticoperator), they behave
like the integers0 and 1, respectively.
The built-in function bool() can be used to cast any value to a Boolean, if the value can be interpreted as
a truth value.
This is very basic answer, can some body add more points
Boolean or bool consists of operators such as AND, OR, NOT and XOR. Booleans are commonly used in programming to set
the result in the value of TRUE or FALSE.
I am searching for free JSON API string to build
my demo application, any references?
I found couple of links, which might be useful for your requirement.
- https://www.reddit.com/.json (without CORSrestriction)
- http://chancejs.com
- http://jsonplaceholder.typicode.com
You have to build a backend using php for example. Set specific URI's for specific functionality to handle
POST or GET requests.For example for login purposes you can set a url //example.com/login and send
your login username and password.
On that link your PHP getsthe data, and logs or rejectsto log the user according the the data. Or you can
get just information from the database. For example //example.com/getpost/?id=1. From the linkyou
php gets the Id, and after fetchingthe data from the database, buldsas a json, and returnsthe data.
When should you use Div, Section or Article?
Div : Div is a block element.
Section: section groups the content related to a single concept / topic, its like a subsection of a major
article. Similar to a new paper section, it might have header, body and footer (may be).
Article: you can understand it asa complete document, which can be distributable asindependent
component.
It makes no difference when you are looking from the view of designer!There are all html blocks, which
you can change, manage usingcss as you want the same way. It makesmore sense when your are
looking on them from the view of SEO. It makesreally much more difference!In articlesSearch engines
are looking for articlesfirst, and for articlessearch engines are looking in articlestag. So You deside
when to use which one. Sections are more for logical sections, when your tryingto divide your page to
logical sections, not usingmany divs which will make your html structure more complicated. They came
to help to structure more effective, and easy.
public static void main(String []args) in detail
thisis we called asmain method.atleast in one place it should exist in a program.
here
"public" will defines"access modifier",
static will define "type of method"by which we need to decide either we need to refer with "classname"
r "objectname".
void will define "return tye of the method".
"(string[ ]args)" will defines "object of args of string class".
Java is a pure Object Oriented Language. Anythingyou write in a Java Program should reside in a Class.
Assume you have write a simple java program. So you write a Classnamed that containsthe methods
which perform your logic.
Now to run your logic you have to create an object to your class. So to create an object you should have
atleast one method that have access with out creating an object. Hence the main method was declared
as "static". Now the Java Virtual Machine(JVM) can call the main method as ClassName.main()
public is the access specifier which tells that the main method can be accessed from outside the class.
void is the return type of the main method.
String[] args is used to pass any arguments. Java only accepts the array of Stringsas arguments.
Why Constructor name is same as Class name
Constructor is called immediatelyafter an object of a class is created. To reduce the number of keywords
in Java, name of the constructor is defined same as the Class name. The Java developersdon't want to
include new keyword for constructor. They want to keep it simple and precise.
So that it can be unambigouslyidentified asthe constructor. and how its get invoked implicitlywhen we
create object of that class. It is invoked by the compiler because it hasalreadybeen unambiguously
identified because of itsnamingsheme.
What is the difference between a Window and a
Frame?
The Frame class extends Window to define a main application window that can have a menu bar.
Frame: It is a window with title bars and borders.It is within a window and It has title bar,
border, close button, minimize button, resizable and movable options.Frame is a part of a
window.
Window: It is an imaginary rectangle area on the monitor.It does not have title bar, border and any
close button.
Window is not a part of window.
Frame:
1.It is a window with title barsand borders.
2.Frame is within a window.
3.It has title bar, border, close button, minimize button, resizable and movable options.
4.Frame is a part of a window.
Window:
1.It is an imaginaryrectangle area on the monitor.
2.Window will not in a frame.
3.It does not have title bar, border and any close button.
4.Window is not a part of window.

More Related Content

PPT
Java basic
PPT
SMI - Introduction to Java
PPSX
Elements of Java Language
PPT
Java Basics
PDF
Top 10 Java Interview Questions and Answers 2014
PPTX
Top 20 c# interview Question and answers
DOCX
Notes of java first unit
ZIP
Introduction to the Java(TM) Advanced Imaging API
Java basic
SMI - Introduction to Java
Elements of Java Language
Java Basics
Top 10 Java Interview Questions and Answers 2014
Top 20 c# interview Question and answers
Notes of java first unit
Introduction to the Java(TM) Advanced Imaging API

What's hot (18)

DOCX
Dot Net Accenture
PDF
C# Advanced L07-Design Patterns
PDF
Basic Java Programming
PPT
Hibernate introduction
PPTX
Basics of Java
PDF
Class 1
PPTX
Object oriented programming-with_java
PPT
Object Oriented Programming with Java
PDF
Java Interview Questions
PDF
JAVA PROGRAMMING- Exception handling - Multithreading
PDF
Class 1 blog
DOCX
Java notes
PPTX
Java training in delhi
PPTX
Java interview questions 1
PDF
50+ java interview questions
PPT
Java interview-questions-and-answers
PPTX
Java interview questions 2
PDF
Java Presentation For Syntax
Dot Net Accenture
C# Advanced L07-Design Patterns
Basic Java Programming
Hibernate introduction
Basics of Java
Class 1
Object oriented programming-with_java
Object Oriented Programming with Java
Java Interview Questions
JAVA PROGRAMMING- Exception handling - Multithreading
Class 1 blog
Java notes
Java training in delhi
Java interview questions 1
50+ java interview questions
Java interview-questions-and-answers
Java interview questions 2
Java Presentation For Syntax
Ad

Similar to Java interview questions and answers (20)

PPTX
Object Oriented Programming unit 1 content for students
PPTX
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
PPTX
Unit 1 – Introduction to Java- (Shilpa R).pptx
PDF
Javanotes
PPT
Introduction
PPTX
PDF
Class 1
PDF
Example Of Import Java
PPT
C++ classes tutorials
PPT
Intro Java Rev010
PDF
20 most important java programming interview questions
PPT
Java for Mainframers
PDF
JavaScript Miller Columns
DOCX
Prg421
PPTX
Session 02 - Elements of Java Language
PDF
Object-Oriented Programming in Java.pdf
DOCX
Viva file
PPTX
1.introduction to java
PPTX
Introduction to Core Java Programming
PPT
Chapter1pp
Object Oriented Programming unit 1 content for students
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Mod...
Unit 1 – Introduction to Java- (Shilpa R).pptx
Javanotes
Introduction
Class 1
Example Of Import Java
C++ classes tutorials
Intro Java Rev010
20 most important java programming interview questions
Java for Mainframers
JavaScript Miller Columns
Prg421
Session 02 - Elements of Java Language
Object-Oriented Programming in Java.pdf
Viva file
1.introduction to java
Introduction to Core Java Programming
Chapter1pp
Ad

Recently uploaded (20)

PDF
Understanding Forklifts - TECH EHS Solution
PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
System and Network Administraation Chapter 3
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Nekopoi APK 2025 free lastest update
PPTX
Transform Your Business with a Software ERP System
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
System and Network Administration Chapter 2
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Understanding Forklifts - TECH EHS Solution
Designing Intelligence for the Shop Floor.pdf
Reimagine Home Health with the Power of Agentic AI​
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
System and Network Administraation Chapter 3
Why Generative AI is the Future of Content, Code & Creativity?
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Digital Systems & Binary Numbers (comprehensive )
Design an Analysis of Algorithms I-SECS-1021-03
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Softaken Excel to vCard Converter Software.pdf
PTS Company Brochure 2025 (1).pdf.......
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Nekopoi APK 2025 free lastest update
Transform Your Business with a Software ERP System
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
CHAPTER 2 - PM Management and IT Context
Operating system designcfffgfgggggggvggggggggg
System and Network Administration Chapter 2
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises

Java interview questions and answers

  • 1. JAVA Interview Questions and Answers: Can a constructor be made final? No, thisis not possible. staticmembersbelong to a class, but the constructor is needed to create an object. An abstract classis a partiallyimplemented class,which containsabstract methods to be implemented in child class. final restrictsmodification: variablesbecome constant, methodscan't be overridden, and classes can't be inherited. No. constructors are similar to methods,but cannot be invoked directlyby a method call. They are used to initialize new class instances.Like methods, theymay be overloaded What is the APK format? The Android packaging key is compressed with classes,UI's, supportive assetsand manifest.All filesare compressed to a single file is called APK. APK standsfor android Application Package File(APK), it is zip file formatted packages based on the android application code. Android application package (APK) is the package file format used by the Android operatingsystem for distribution and installation of mobile appsand middleware. APK filesare analogous to other software packages such as APPXin Microsoft Windows or Deb packages in Debian-based operatingsystemslike Ubuntu. What do you know about Java? Java is a high-level programminglanguage originallydeveloped bySun Microsystems and released in 1995. Java runs on a varietyof platforms, such as Windows, Mac OS, and the various versions of UNIX. Some of the advantagesof the Java:  The code is compiled into bytecode, it is like code once and run anywhere. It eliminatesthe need for platform-specificversions.  Unlike other languages,the code is very robust.  Object-oriented language.  The appletsrunsfaster  Compared to C++, Java is easy to learn. Java is an portable language which supportsobject oriented featureslike inheritance,polymorphism and encapsulation and it is platform independent once compile and run any where with the help of JVM.IN JVM we have native stack which is used to store non java code and it helps the programer to covert it to java code.
  • 2. What is stored procedure? 1. Stored procedure is a pre-compiled Sql statements. 2. That meansstored procedure will contain sql statementslike SELECT, UPDATE, DELETE and so on which is alreadycompiled. Syntax: Create procedure procedurename () As Begin { } end A stored procedure is a bunch of SQL statementsthat are stored in the DB. The different types of stored procedures; a) System Stored Procedures b) User Defined Stored Proceduresc) Extended Stored Procedures.These procedureswill accept input parametersso that a single procedure can be called by several clients. The benefits of the Stored Procedures are: - Faster Execution - Implementsmodule programming - Minimize the networktraffic Stored procedure is simplya set operationsperformed on table...with different conditions. what is boolean? Boolean valuesare the two constant objects True and False, are used to represent truth values(other valuescan also be considered false or true). In numericcontexts (for example, when used as the argument to an arithmeticoperator), they behave like the integers0 and 1, respectively. The built-in function bool() can be used to cast any value to a Boolean, if the value can be interpreted as a truth value. This is very basic answer, can some body add more points Boolean or bool consists of operators such as AND, OR, NOT and XOR. Booleans are commonly used in programming to set the result in the value of TRUE or FALSE. I am searching for free JSON API string to build my demo application, any references? I found couple of links, which might be useful for your requirement. - https://www.reddit.com/.json (without CORSrestriction) - http://chancejs.com - http://jsonplaceholder.typicode.com
  • 3. You have to build a backend using php for example. Set specific URI's for specific functionality to handle POST or GET requests.For example for login purposes you can set a url //example.com/login and send your login username and password. On that link your PHP getsthe data, and logs or rejectsto log the user according the the data. Or you can get just information from the database. For example //example.com/getpost/?id=1. From the linkyou php gets the Id, and after fetchingthe data from the database, buldsas a json, and returnsthe data. When should you use Div, Section or Article? Div : Div is a block element. Section: section groups the content related to a single concept / topic, its like a subsection of a major article. Similar to a new paper section, it might have header, body and footer (may be). Article: you can understand it asa complete document, which can be distributable asindependent component. It makes no difference when you are looking from the view of designer!There are all html blocks, which you can change, manage usingcss as you want the same way. It makesmore sense when your are looking on them from the view of SEO. It makesreally much more difference!In articlesSearch engines are looking for articlesfirst, and for articlessearch engines are looking in articlestag. So You deside when to use which one. Sections are more for logical sections, when your tryingto divide your page to logical sections, not usingmany divs which will make your html structure more complicated. They came to help to structure more effective, and easy. public static void main(String []args) in detail thisis we called asmain method.atleast in one place it should exist in a program. here "public" will defines"access modifier", static will define "type of method"by which we need to decide either we need to refer with "classname" r "objectname". void will define "return tye of the method". "(string[ ]args)" will defines "object of args of string class". Java is a pure Object Oriented Language. Anythingyou write in a Java Program should reside in a Class. Assume you have write a simple java program. So you write a Classnamed that containsthe methods which perform your logic. Now to run your logic you have to create an object to your class. So to create an object you should have atleast one method that have access with out creating an object. Hence the main method was declared as "static". Now the Java Virtual Machine(JVM) can call the main method as ClassName.main() public is the access specifier which tells that the main method can be accessed from outside the class.
  • 4. void is the return type of the main method. String[] args is used to pass any arguments. Java only accepts the array of Stringsas arguments. Why Constructor name is same as Class name Constructor is called immediatelyafter an object of a class is created. To reduce the number of keywords in Java, name of the constructor is defined same as the Class name. The Java developersdon't want to include new keyword for constructor. They want to keep it simple and precise. So that it can be unambigouslyidentified asthe constructor. and how its get invoked implicitlywhen we create object of that class. It is invoked by the compiler because it hasalreadybeen unambiguously identified because of itsnamingsheme. What is the difference between a Window and a Frame? The Frame class extends Window to define a main application window that can have a menu bar. Frame: It is a window with title bars and borders.It is within a window and It has title bar, border, close button, minimize button, resizable and movable options.Frame is a part of a window. Window: It is an imaginary rectangle area on the monitor.It does not have title bar, border and any close button. Window is not a part of window. Frame: 1.It is a window with title barsand borders. 2.Frame is within a window. 3.It has title bar, border, close button, minimize button, resizable and movable options. 4.Frame is a part of a window. Window: 1.It is an imaginaryrectangle area on the monitor. 2.Window will not in a frame. 3.It does not have title bar, border and any close button. 4.Window is not a part of window.