Wednesday 26 December 2012

IT2305 JAVA PROGRAMMING LAB MANUAL VIVA QUESTION - Anna University - COMMON TO INFORMATION TECHNOLOGY

JAVA LAB VIVA QUESTIONS

 Object     :    Objects have states and behaviors. Example: A dog has states-color, name, breed as
     well as behaviors -wagging, barking, eating. An object is an instance of a class.
Class        :      A class can be defined as a template/ blue print that describe the behaviors/states  
        that object of its type suppor
Define overloading    :  Two methods may not have the same name and argument list but
different return types.
Output Statement    :      System.out.println(“”)
Input Statement         :       DataInputStream dis = new DataInputStream()
Define Inheritance         :
The properties( variable & methods)  inherited from various class the processes is known as inheritance
Key words:
extends, super class , base class
super class : the properties are inherited from this class
sub class / derived class : which class is inheriting  properties from  base class
Types :
a.       Single inheritance
b.      Multi level inheritance
c.       Hierarchical inheritance

Interface

Methods form the object's interface with the outside world; the buttons on the front of your television set, for example, are the interface between you and the electrical wiring on the other side of its plastic casing. You press the "power" button to turn the television on and off.

Package

              Collection of classes is known as package . A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar to different folders on your computer.

Thread

A thread, in the context of Java, is the path followed when executing a program. All Java programs have at least one thread, known as the main thread, which is created by the JVM at the program’s start, when the main() method is invoked with the main thread. In Java, creating a thread is accomplished by implementing an interface and extending a class. Every Java thread is created and controlled by the java.lang.Thread class.

When a thread is created, it is assigned a priority. The thread with higher priority is executed first, followed by lower-priority threads. The JVM stops executing threads under either of the following conditions:
  • If the exit method has been invoked and authorized by the security manager.
  • All the daemon threads of the program have died.
Define Synchronization :
Threads communicate primarily by sharing access to fields and the objects reference fields refer to. This form of communication is extremely efficient, but makes two kinds of errors possible: thread interference and memory consistency errors. The tool needed to prevent these errors is synchronization.
Define RMI : 
  The Java Remote Method Invocation (RMI) system allows an object running in one Java virtual machine to invoke methods on an object running in another Java virtual machine. RMI provides for remote communication between programs written in the Java programming language.
Exceptions:
 The Java programming language uses exceptions to handle errors and other exceptional events. This lesson describes when and how to use exceptions.
Types of Exception :
 Arithmetic Exception()
Interrupted Exception()
Array IndexOutOfBound Exception()
StringIndexOutOfBound Exception()
ClassNotFoundException()
NegativeArraySizeException()
Description of program:
This program establishes the connection between MySQL database and java files with the help of various types of APIs interfaces and methods. If connection is established then it shows "Connected to the database" otherwise it will displays a message "Disconnected from database".
Connection:                   
This is an interface in  java.sql package that specifies connection with specific database like: MySQL, Ms-Access, Oracle etc and java files. The SQL statements are executed within the context of the Connection interface.
Class.forName(String driver):
This method is static. It attempts to load the class and returns class instance and takes string type value (driver) after that matches class with given string.

DriverManager:
It is a class of java.sql package that controls a set of JDBC drivers. Each driver has to be register with this class.

getConnection(String url, String userName, String password):
This method establishes a connection to specified database url. It takes three string types of arguments like: 

    url: - Database url where stored or created your database
  userName: - User name of MySQL
  password: -Password of MySQL 

con.close():
This method is used for disconnecting the connection. It frees all the resources occupied by the database.

printStackTrace():
The method is used to show error messages. If the connection is not established then exception is thrown and print the message.

Define JVM :
        Java Virual Machine
Define Byte Code:                                                                             
                          Interupted Code  ,Java Programs are Converted into Byte Code Before the Executable code.


Layout Manager:

   To arrange the components in Any particular order
 1.FlowLayout manager
 2.Border Layout Manager
 3.Grid Layout manager


Applet :

Applet is java program that can be embedded into HTML pages. Java applets runs on the java enables web browsers such as mozila and internet explorer. Applet is designed to run remotely on the client browser, so there are some restrictions on it. Applet can't access system resources on the local computer. Applets are used to make the web site more dynamic and entertaining. 
Advantages of Applet:
  • Applets are cross platform and can run on Windows, Mac OS and Linux platform
  • Applets can work all the version of Java Plugin
  • Applets runs in a sandbox, so the user does not need to trust the code, so it can work without security approval
  • Applets are supported by most web browsers
  • Applets are cached in most web browsers, so will be quick to load when returning to a web page
  • User can also have full access to the machine if user allows
Disadvantages of Java Applet:
  • Java plug-in is required to run applet
  • Java applet requires JVM so first time it takes significant startup time
  • If applet is not already cached in the machine, it will be downloaded from internet and will take time
  • Its difficult to desing and build good user interface in applets compared to HTML technology


Don't You Think this Awesome Post should be shared ??
| IT2305 JAVA PROGRAMMING LAB MANUAL VIVA QUESTION - Anna University - COMMON TO INFORMATION TECHNOLOGY |
Back To Top Related Posts Plugin for WordPress, Blogger...