java viva questions and answers for lab pdf
#1

Reply
#2

1. What is the difference between a constructor and a method?

A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator.

A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator.

2. What is the purpose of garbage collection in Java, and when is it used?

The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused.

A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used.

3. Describe synchronization in respect to multithreading.

With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources.

Without synchonization, it is possible for one thread to modify a shared variable while another thread is in the process of using or updating same shared variable. This usually leads to significant errors.

4. What is an abstract class?

Abstract class must be extended/subclassed (to be useful). It serves as a template. A class that is abstract may not be instantiated (ie. you may not call its constructor), abstract class may contain static data.

Any class with an abstract method is automatically abstract itself, and must be declared as such. A class may be declared abstract even if it has no abstract methods. This prevents it from being instantiated.

5. What is the difference between an Interface and an Abstract class?

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. An abstract class is a class which may have the usual flavors of class members (private, protected, etc.), but has some abstract methods.

6. Explain different way of using thread?

The thread could be implemented by using runnable interface or by inheriting from the Thread class. The former is more advantageous, 'cause when you are going for multiple inheritance, the only interface can help.
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: java viva questions and answers, c lab viva questions and answers pdf, open sourse technology lab viva questions and answers pdf, eca lab viva questions and answers pdf, important lab external viva questions java, viva questions for java lab with answers for b tech 2 2, core java viva questions and answers,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  simple java rmi chat application source code 2 18,986 20-07-2018, 12:08 PM
Last Post: Guest
  pdf k53 learners test questions and answers 2015 pdf 2 11,125 18-05-2018, 06:21 PM
Last Post: Guest
  viva question answer of flywheel experiment pdf 2 3,729 22-02-2018, 03:12 PM
Last Post: Guest
  free download source code for online movie ticket booking in java 2 18,495 15-08-2017, 03:21 PM
Last Post: Morshed
  source code for rsa encryption and decryption in java 2 7,929 29-05-2017, 04:21 PM
Last Post: Meghna Jadhav
Thumbs Up online catering management system on php with report and source code and ppt 4 8,720 29-04-2017, 10:59 AM
Last Post: jaseela123d
  surveying 2 lab viva questions with answers pdf free download 3 1,387 26-04-2017, 09:47 AM
Last Post: jaseela123d
  source code for task scheduling using genetic algorithm using java 2 8,447 11-04-2017, 08:31 PM
Last Post: Guest
  physics practical viva questions for bsc 4 1,947 15-02-2017, 02:06 PM
Last Post: jaseela123d
  cp7102 2 marks with answers 2 782 27-09-2016, 02:48 PM
Last Post: Guest

Forum Jump: