[go: up one dir, main page]

0% found this document useful (0 votes)
21 views21 pages

Java Viva Ques.

The document contains a comprehensive list of questions and answers related to Java programming, covering topics such as Java's features, object-oriented principles, exception handling, and multithreading. It includes definitions, explanations, and comparisons of various Java concepts, including classes, objects, interfaces, and data types. Additionally, it addresses practical aspects like the use of constructors, access modifiers, and the differences between various Java classes and methods.

Uploaded by

pankajpushpatode
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)
21 views21 pages

Java Viva Ques.

The document contains a comprehensive list of questions and answers related to Java programming, covering topics such as Java's features, object-oriented principles, exception handling, and multithreading. It includes definitions, explanations, and comparisons of various Java concepts, including classes, objects, interfaces, and data types. Additionally, it addresses practical aspects like the use of constructors, access modifiers, and the differences between various Java classes and methods.

Uploaded by

pankajpushpatode
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/ 21

VIVA QUESTIONS

Q:1 What do you know about Java?

A:1 Java is a high-level programming language originally developed by Sun Microsystems


and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the
various versions of UNIX.

Q:2 What are the supported platforms by Java Programming Language?

A:2 Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions
of UNIX/Linux like HP-Unix, Sun Solaris, Redhat Linux, Ubuntu, CentOS, etc.

Q:3 Why is Java Architectural Neutral?

A:3 It’s compiler generates an architecture-neutral object file format, which makes the
compiled code to be executable on many processors, with the presence of Java runtime
system.

Q:4 Why Java is considered dynamic?

A:4 It is designed to adapt to an evolving environment. Java programs can carry extensive
amount of run-time information that can be used to verify and resolve accesses to objects on
run-time.

Q:5 What is Java Virtual Machine and how it is considered in context of Java’s
platform independent feature?

A:5 When Java is compiled, it is not compiled into platform specific machine, rather into
platform independent byte code. This byte code is distributed over the web and interpreted by
virtual Machine (JVM) on whichever platform it is being run.

Q:6 List two Java IDE’s?

A:6 Netbeans, Eclipse, etc.

Q:7 List some Java keywords(unlike C, C++ keywords)?


A:7 Some Java keywords are import, super, finally, etc.

Q:8 What do you mean by Object?

A:8 Object is a runtime entity and it’s state is stored in fields and behavior is shown via
methods. Methods operate on an object's internal state and serve as the primary mechanism
for object-to-object communication.

Q:9 Define class?

A:9 A class is a blue print from which individual objects are created. A class can contain
fields and methods to describe the behavior of an object.

Q:10 What kind of variables a class can consist of?

A:10 A class consist of Local variable, instance variables and class variables.

Q:11 What is a Local Variable

A:12 Variables defined inside methods, constructors or blocks are called local variables. The
variable will be declared and initialized within the method and it will be destroyed when the
method has completed.

Q:13 What is a Instance Variable

A:13 Instance variables are variables within a class but outside any method. These variables
are instantiated when the class is loaded.

Q:14 What is a Class Variable

A:14 These are variables declared with in a class, outside any method, with the static
keyword.

Q:15 What do you mean by Constructor?

A:15 Constructor gets invoked when a new object is created. Every class has a constructor.
If we do not explicitly write a constructor for a class the java compiler builds a default
constructor for that class.
Q:16 List the three steps for creating an Object for a class?

A:16 An Object is first declared, then instantiated and then it is initialized.

Q:17 What is the default value of byte datatype in Java?

A:17 Default value of byte datatype is 0.

Q:18 What is the default value of float and double datatype in Java?

A:19 Default value of float and double datatype in different as compared to C/C++. For float
its 0.0f and for double it’s 0.0d

Q:20 When a byte datatype is used?

A:20 This data type is used to save space in large arrays, mainly in place of integers, since a
byte is four times smaller than an int.

Q:21 What is a static variable?

A:21 Class variables also known as static variables are declared with the static keyword in a
class, but outside a method, constructor or a block.

Q:22 What do you mean by Access Modifier?

A:22 Java provides access modifiers to set access levels for classes, variables, methods and
constructors. A member has package or default accessibility when no accessibility modifier is
specified.

Q:23 What is protected access modifier?

A:23 Variables, methods and constructors which are declared protected in a superclass can
be accessed only by the subclasses in other package or any class within the package of the
protected members' class.

Q:24 According to Java Operator precedence, which operator is considered to be with


highest precedence?
A:24 Postfix operators i.e () [] . is at the highest precedence.

Q:25 Variables used in a switch statement can be used with which datatypes?

A:25 Variables used in a switch statement can only be a byte, short, int, or char.

Q:26 When parseInt() method can be used?

A:26 This method is used to get the primitive data type of a certain String.

Q:27 Why is String class considered immutable?

A:27 The String class is immutable, so that once it is created a String object cannot be
changed. Since String is immutable it can safely be shared between many threads ,which is
considered very important for multithreaded programming.

Q:28 Why is StringBuffer called mutable?

A:28 The String class is considered as immutable, so that once it is created a String object
cannot be changed. If there is a necessity to make alot of modifications to Strings of
characters then StringBuffer should be used.

Q:29 What is the difference between StringBuffer and StringBuilder class?

A: Use StringBuilder whenever possible because it is faster than StringBuffer. But, if thread
safety is necessary then use StringBuffer objects.

Q:30 Which package is used for pattern matching with regular expressions?

A:30 java.util.regex package is used for this purpose.

Q:31 What is finalize() method?

A:31 It is possible to define a method that will be called just before an object's final
destruction by the garbage collector. This method is called finalize( ), and it can be used to
ensure that an object terminates cleanly.

Q:32 What is an Exception?


A:32 An exception is a problem that arises during the execution of a program. Exceptions
are caught by handlers positioned along the thread's method invocation stack.

Q:33 What do you mean by Checked Exceptions?

A:33 It is an exception that is typically a user error or a problem that cannot be foreseen by
the programmer. For example, if a file is to be opened, but the file cannot be found, an
exception occurs. These exceptions cannot simply be ignored at the time of compilation.

Q:34 Explain Runtime Exceptions?

A:34 It is an exception that occurs that probably could have been avoided by the
programmer. As opposed to checked exceptions, runtime exceptions are ignored at the time
of compliation.

Q:35 Which are the two subclasses under Exception class?

A: The Exception class has two main subclasses : IOException class and RuntimeException
Class.

Q:36 When throws keyword is used?

A:36 If a method does not handle a checked exception, the method must declare it using the
throwskeyword. The throws keyword appears at the end of a method's signature.

Q:37 When throw keyword is used?

A:37 An exception can be thrown, either a newly instantiated one or an exception that you
just caught, by using throw keyword.

Q:38 How finally used under Exception Handling?

A:38 The finally keyword is used to create a block of code that follows a try block. A finally
block of code always executes, whether or not an exception has occurred.

Q:39 What things should be kept in mind while creating your own exceptions in Java?

A:39 While creating your own exception:


 All exceptions must be a child of Throwable.
 If you want to write a checked exception that is automatically enforced by the Handle
or Declare Rule, you need to extend the Exception class.
 You want to write a runtime exception, you need to extend the RuntimeException
class.

Q:40 Define Inheritance?

A:40 It is the process where one object acquires the properties of another. With the use of
inheritance the information is made manageable in a hierarchical order.

Q:41 When super keyword is used?

A:41 If the method overrides one of its superclass's methods, overridden method can be
invoked through the use of the keyword super. It can be also used to refer to a hidden field

Q:42 What is Polymorphism?

A:42 Polymorphism is the ability of an object to take on many forms. The most common use
of polymorphism in OOP occurs when a parent class reference is used to refer to a child class
object.

Q:43 What is Abstraction?

A:43 It refers to the ability to make a class abstract in OOP. It helps to reduce the complexity
and also improves the maintainability of the system.

Q:44 What is Abstract class

A:44 These classes cannot be instantiated and are either partially implemented or not at all
implemented. This class contains one or more abstract methods which are simply method
declarations without a body.

Q:45 When Abstract methods are used?


A:45 If you want a class to contain a particular method but you want the actual
implementation of that method to be determined by child classes, you can declare the method
in the parent class as abstract.

Q:46 What is Encapsulation?

A:46 It is the technique of making the fields in a class private and providing access to the
fields via public methods. If a field is declared private, it cannot be accessed by anyone
outside the class, thereby hiding the fields within the class. Therefore encapsulation is also
referred to as data hiding.

Q:47 What is the primary benefit of Encapsulation?

A:47 The main benefit of encapsulation is the ability to modify our implemented code
without breaking the code of others who use our code. With this Encapsulation gives
maintainability, flexibility and extensibility to our code.

Q:48 What is an Interface?

A:48 An interface is a collection of abstract methods. A class implements an interface,


thereby inheriting the abstract methods of the interface.

Q:49 Give some features of Interface?

A:49 It includes:

 Interface cannot be instantiated


 An interface does not contain any constructors.
 All of the methods in an interface are abstract.

Q:50 Define Packages in Java?

A:50 A Package can be defined as a grouping of related types(classes, interfaces,


enumerations and annotations ) providing access protection and name space management.

Q:51 Why Packages are used?


A:51 Packages are used in Java in-order to prevent naming conflicts, to control access, to
make searching/locating and usage of classes, interfaces, enumerations and annotations, etc.,
easier.

Q:52 What do you mean by Multithreaded program?

A:52 A multithreaded program contains two or more parts that can run concurrently. Each
part of such a program is called a thread, and each thread defines a separate path of
execution.

Q:53 What are the two ways in which Thread can be created?

A:53 Thread can be created by: implementing Runnable interface, extending the Thread
class.

Q:54 What is an applet?

A:54 An applet is a Java program that runs in a Web browser. An applet can be a fully
functional Java application because it has the entire Java API at its disposal.

Q:55 An applet extend which class?

A:55 An applet extends java.applet.Applet class.

Q:56 Explain garbage collection in Java?

A:56 It uses garbage collection to free the memory. By cleaning those objects that is no
longer reference by any of the program.

Q:57 Define immutable object?

A:57 An immutable object can’t be changed once it is created.

Q:58 Explain the usage of this() with constructors?

A:58 It is used with variables or methods and used to call constructer of same class.

Q:59 Explain TreeSet?


A:59 It is a Set implemented when we want elements in a sorted order.

Q:60 What is Comparable Interface?

A:60 It is used to sort collections and arrays of objects using the collections.sort() and
java.utils. The objects of the class implementing the Comparable interface can be ordered.

Q:61 Difference between throw and throws?

A:61 It includes:

 Throw is used to trigger an exception where as throws is used in declaration of


exception.
 Without throws, Checked exception cannot be handled where as checked exception
can be propagated with throws.

Q:62 Explain the following line used under Java Program:

public static void main (String args[ ])

A:62 The following shows the explanation individually:

 public: it is the access specifier.


 static: it allows main() to be called without instantiating a particular instance of a
class.
 void: it affirns the compiler that no value is returned by main().
 main(): this method is called at the beginning of a Java program.
 String args[ ]: args parameter is an instance array of class String

Q:63 Define JRE i.e. Java Runtime Environment?

A:63 Java Runtime Environment is an implementation of the Java Virtual Machine which
executes Java programs. It provides the minimum requirements for executing a Java
application;

Q:64 What is JAR file?


A:64 JAR files is Java Archive fles and it aggregates many files into one. It holds Java
classes in a library. JAR files are built on ZIP file format and have .jar file extension.

Q:65 What is a WAR file?

A:65 This is Web Archive File and used to store XML, java classes, and JavaServer pages.
which is used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, XML
files, static Web pages etc.

Q:66 Define JIT compiler?

A:66 It improves the runtime performance of computer programs based on bytecode.

Q:67 What is the difference between object oriented programming language and object
based programming language?

A:67 Object based programming languages follow all the features of OOPs except
Inheritance. JavaScript is an example of object based programming languages

Q:68 What is the purpose of default constructor?

A:68 The java compiler creates a default constructor only if there is no constructor in the
class.

Q:69 Can a constructor be made final?

A:69 No, this is not possible.

Q:70 What is static block?

A:70 It is used to initialize the static data member, It is excuted before main method at the
time of classloading.

Q:71 What is function overloading?

A:71 If a class has multiple functions by same name but different parameters, it is known as
Method Overloading.
Q:72 What is function overriding?

A:72 If a subclass provides a specific implementation of a method that is already provided


by its parent class, it is known as Method Overriding.

Q:73 Difference between Overloading and Overriding?

A:73 Method overloading increases the readability of the program. Method overriding
provides the specific implementation of the method that is already provided by its super class
parameter must be different in case of overloading, parameter must be same in case of
overriding.

Q:74 What is final class?

A:74 Final classes are created so the methods implemented by that class cannot be
overridden. It can’t be inherited.

Q:75 What is NullPointerException?

A:75 A NullPointerException is thrown when calling the instance method of a null object,
accessing or modifying the field of a null object etc.

Q:76 What are the ways in which a thread can enter the waiting state?

A: A thread can enter the waiting state by invoking its sleep() method, by blocking on IO, by
unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait()
method. It can also enter the waiting state by invoking its (deprecated) suspend() method.

Q:77 How does multi-threading take place on a computer with a single CPU?

A:77 The operating system's task scheduler allocates execution time to multiple tasks. By
quickly switching between executing tasks, it creates the impression that tasks execute
sequentially.

Q:78 What invokes a thread's run() method?

A:78 After a thread is started, via its start() method of the Thread class, the JVM invokes the
thread's run() method when the thread is initially executed.
Q:79 Does it matter in what order catch statements for FileNotFoundException and
IOException are written?

A:79 Yes, it does. The FileNoFoundException is inherited from the IOException.


Exception's subclasses have to be caught first.

Q:80 What is the difference between yielding and sleeping?

A:80 When a task invokes its yield() method, it returns to the ready state. When a task
invokes its sleep() method, it returns to the waiting state.

Q:81 Why Vector class is used?

A:81 The Vector class provides the capability to implement a growable array of objects.
Vector proves to be very useful if you don't know the size of the array in advance, or you just
need one that can change sizes over the lifetime of a program.

Q:82 How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8
characters?

A:82 Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set
uses only 7 bits, it is usually represented as 8 bits. UTF-8 represents characters using 8, 16,
and 18 bit patterns. UTF-16 uses 16-bit and larger bit patterns.

Q:83 What are Wrapper classes?

A:83 These are classes that allow primitive types to be accessed as objects. Example:
Integer, Character, Double, Boolean etc.

Q:84 What is the difference between a Window and a Frame?

A:84 The Frame class extends Window to define a main application window that can have a
menu bar.

Q:85 Which package has light weight components?

A:85 javax.Swing package. All components in Swing, except JApplet, JDialog, JFrame and
JWindow are lightweight components.
Q:86 What is the difference between the paint() and repaint() methods?

A:86 The paint() method supports painting via a Graphics object. The repaint() method is
used to cause paint() to be invoked by the AWT painting thread.

Q:87 What is the purpose of File class?

A:87 It is used to create objects that provide access to the files and directories of a local file
system.

Q:88 What is the difference between the Reader/Writer class hierarchy and the
InputStream/OutputStream class hierarchy?

A:88 The Reader/Writer class hierarchy is character-oriented, and the


InputStream/OutputStream class hierarchy is byte-oriented.

Q:89 Which class should you use to obtain design information about an object?

A:89 The Class class is used to obtain information about an object's design and
java.lang.Class class instance represent classes, interfaces in a running Java application.

Q:90 What is the difference between static and non-static variables?

A:90 A static variable is associated with the class as a whole rather than with specific
instances of a class. Non-static variables take on unique values with each object instance.

Q:91 What is Serialization and deserialization?

A:91 Serialization is the process of writing the state of an object to a byte stream.
Deserialization is the process of restoring these objects.

Q:92 What are use cases?

A:92 It is part of the analysis of a program and describes a situation that a program might
encounter and what behavior the program should exhibit in that circumstance.

Q:93 Explain the use of sublass in a Java program?


A:93 Sub class inherits all the public and protected methods and the implementation. It also
inherits all the default modifier methods and their implementation.

Q: 94 How to add menushortcut to menu item?

A: 94 If there is a button instance called b1, you may add menu short cut by calling
b1.setMnemonic('F'), so the user may be able to use Alt+F to click the button.

Q: 95 Can you write a Java class that could be used both as an applet as well as an
application?

A: 95 Yes, just add a main() method to the applet.

Q: 96 What is the difference between Swing and AWT components?

A: 96 AWT components are heavy-weight, whereas Swing components are lightweight.


Heavy weight components depend on the local windowing toolkit. For example,
java.awt.Button is a heavy weight component, when it is running on the Java platform for
Unix platform, it maps to a real Motif button.

Q: 97 What's the difference between constructors and other methods?

A:97 Constructors must have the same name as the class and can not return a value. They are
only called once while regular methods could be called many times.

Q:98 Is there any limitation of using Inheritance?

A:98 Yes, since inheritance inherits everything from the super class and interface, it may
make the subclass too clustering and sometimes error-prone when dynamic overriding or
dynamic overloading in some situation.

Q:99 When ArithmeticException is thrown?

A:99 The ArithmeticException is thrown when integer is divided by zero or taking the
remainder of a number by zero. It is never thrown in floating-point operations.

Q:100 What is a transient variable?


A:100 A transient variable is a variable that may not be serialized during Serialization and
which is initialized by its default value during de-serialization,

Q:101 What is synchronization?

A:101 Synchronization is the capability to control the access of multiple threads to shared
resources. synchronized keyword in java provides locking which ensures mutual exclusive
access of shared resource and prevent data race.

Q:102 What is the Collections API?

A: 102 The Collections API is a set of classes and interfaces that support operations on
collections of objects..

Q: 103 The immediate superclass of the Applet class?

A: 103 Panel is the immediate superclass. A panel provides space in which an application can
attach any other component, including other panels.

Q: 104 What is the difference between a break statement and a continue statement?

A: 104 A break statement results in the termination of the statement to which it applies
(switch, for, do, or while). A continue statement is used to end the current loop iteration and
return control to the loop statement.

Q:105 If a variable is declared as private, where may the variable be accessed?

A:105 A private variable may only be accessed within the class in which it is declared.

Q:106 List primitive Java types?

A:106 The eight primitive types are byte, char, short, int, long, float, double, and boolean.

Q:107 Which class is the immediate superclass of the Container class?

A:107 Component class is the immediate super class.


Q:108 Which arithmetic operations can result in the throwing of an
ArithmeticException?

A: 108 Integer / and % can result in the throwing of an ArithmeticException.

Q:109 Variable of the boolean type is automatically initialized as?

A:109 The default value of the boolean type is false.

Q:110 Can try statements be nested?

A:110 Yes

Q:111 What is the difference between an Interface and an Abstract class?

A:111 An abstract class can have instance methods that implement a default behavior. An
Interface can only declare constants and instance methods, but cannot implement default
behavior and all methods are implicitly abstract. An interface has all public members and no
implementation.

Q:112 What will happen if static modifier is removed from the signature of the main
method?

A:112 Program throws "NoSuchMethodError" error at runtime .

Q:113 Why do we need wrapper classes?

A:113 We can pass them around as method parameters where a method expects an object. It
also provides utility methods.

Q:114 What is the difference between error and an exception?

A:114 An error is an irrecoverable condition occurring at runtime. Such as OutOfMemory


error. Exceptions are conditions that occur because of bad input etc. e.g.
FileNotFoundException will be thrown if the specified file does not exist.

Q:115 What is the Locale class?


A:115 The Locale class is used to tailor program output to the conventions of a particular
geographic, political, or cultural region.

Q:116 What is runtime polymorphism or dynamic method dispatch?

A:116 Runtime polymorphism or dynamic method dispatch is a process in which a call to an


overridden method is resolved at runtime rather than at compile-time. In this process, an
overridden method is called through the reference variable of a superclass.

Q:117 What is Dynamic Binding(late binding)?

A:117 Binding refers to the linking of a procedure call to the code to be executed in response
to the call. Dynamic binding means that the code associated with a given procedure call is not
known until the time of the call at run-time.

Q:118 Can constructor be inherited?

A:118 No, constructor cannot be inherited.

Q:119 Why deletion in LinkedList is fast than ArrayList?

A:119 Deletion in linked list is fast because it involves only updating the next pointer in the
node before the deleted node and updating the previous pointer in the node after the deleted
node.

Q:120 What is dot operator?

A:120 The dot operator(.) is used to access the instance variables and methods of class
objects.It is also used to access classes and sub-packages from a package.

Q:121 Where and how can you use a private constructor?

A:121 Private constructor is used if you do not want other classes to instantiate the object
and to prevent subclassing.T

Q:122 What is type casting?

A:122 Type casting means treating a variable of one type as though it is another type.
Q:123 Describe life cycle of thread?

A:123 A thread is a execution in a program. The life cycle of a thread include:

 Newborn state
 Runnable state
 Running state
 Blocked state
 Dead state

Q:124 What is the difference between the >> and >>> operators?

A:124 The >> operator carries the sign bit when shifting right. The >>> zero-fills bits that
have been shifted out.

Q:125 Does Java allow Default Arguments?

A:125 No, Java does not allow Default Arguments.

Q:126 Where import statement is used in a Java program?

A:126 Import statement is allowed at the beginning of the program file after package
statement.

Q:127 What is currentThread()?

A:127 It is a public static method used to obtain a reference to the current thread.

Q:128 Life cycle of an applet includes which steps?

A:128 Life cycle involves the following steps:

 Initialization
 Starting
 Stopping
 Destroying
 Painting
Q:129 Why is the role of init() method under applets?

A:129 It initializes the applet and is the first method to be called.

Q:130 Which method is called by Applet class to load an image?

A:130 getImage(URL object, filename) is used for this purpose.

Q:131 Define canvas?

A:131 It is a simple drawing surface which are used for painting images or to perform other
graphical operations.

Q:132 Define Network Programming?

A:132 It refers to writing programs that execute across multiple devices (computers), in
which the devices are all connected to each other using a network.

Q:133 What is a Socket?

A:133 Sockets provide the communication mechanism between two computers using TCP.
A client program creates a socket on its end of the communication and attempts to connect
that socket to a server.

Q:134 Advantages of Java Sockets?

A:134 Sockets are flexible and sufficient. Efficient socket based programming can be easily
implemented for general communications. It cause low network traffic.

Q:135 Disadvantages of Java Sockets?

A:135 Socket based communications allows only to send packets of raw data between
applications. Both the client-side and server-side have to provide mechanisms to make the
data useful in any way.

Q:136 Which class is used by server applications to obtain a port and listen for client
requests?
A:136 java.net.ServerSocket class is used by server applications to obtain a port and listen
for client requests

Q:137 Which class represents the socket that both the client and server use to
communicate with each other?

A:137 java.net.Socket class represents the socket that both the client and server use to
communicate with each other.

Q:138 Why Generics are used in Java?

A:138 Generics provide compile-time type safety that allows programmers to catch invalid
types at compile time. Java Generic methods and generic classes enable programmers to
specify, with a single method declaration, a set of related methods or, with a single class
declaration, a set of related types.

Q:139 What environment variables do I need to set on my machine in order to be able


to run Java programs?

A:139 CLASSPATH and PATH are the two variables.

Q:140 Is there any need to import java.lang package?

A:140 No, there is no need to import this package. It is by default loaded internally by the
JVM.

Q:141 If System.exit (0); is written at the end of the try block, will the finally block still
execute?

A:141 No in this case the finally block will not execute because when you say System.exit
(0); the control immediately goes out of the program, and thus finally never executes.

Q:142 What is daemon thread?

A:142 Daemon thread is a low priority thread, which runs intermittently in the back ground
doing the garbage collection operation for the java runtime system.

Q:143 Which method is used to create the daemon thread?


A:143 setDaemon method is used to create a daemon thread.

Q:144 Which method must be implemented by all threads?

A:144 All tasks must implement the run() method

Q:145 What is the difference between the size and capacity of a Vector?

A:145 The size is the number of elements actually stored in the vector, while capacity is the
maximum number of elements it can store at a given instance of time.

Q:146 What is difference between Path and Classpath?

A:146 Path and Classpath are operating system level environment variales. Path is defines
where the system can find the executables(.exe) files and classpath is used to specify the
location of .class files.

Q:147 Can an Interface extend another Interface?

A:147 Yes an Interface can inherit another Interface, for that matter an Interface can extend
more than one Interface.

Q:148 Which object oriented Concept is achieved by using overloading and overriding?

A:148 Polymorphism

Q:149 What is Downcasting?

A:149 It is the casting from a general to a more specific type, i.e. casting down the hierarchy.

Q:150 What is the difference between inner class and nested class?

A:150 When a class is defined within a scope of another class, then it becomes inner class. If
the access modifier of the inner class is static, then it becomes nested class.

You might also like