JAVA PROGRAMMING
JVM:
Java Virtual Machine (JVM) is a program which behaves as interpreter and translates byte code
into machine language as they go called just in time compilation.
RAD:
Rapid Application Development is software programming technique that allow quick development of
software application.
Source Code: The core program or text which is written in a language like C,C++ or Java is
called source code.
Object Code: The program which only is understood by the computer in the form of machine
instructions or binary instructions called object code. In Java JVM is used to generate object
code in the form of byte code.
Byte code: A byte code is long instruction that the Java compiler generates and Java
interpreter executes. When the compiler compiles a .java file, it produces a series of bytecodes
and stores them in a .class file. The Java interpreter (JVM) can execute the byte codesstored in
the .class file.
Token: The
smallest individual unit in a program is known as Token. Java has the
following types of tokens: keyword, Identifier, literal, punctuators and operators.
Keywords
Keywords are words that have a specific predefined meaning in Java.
They cannot be used as variable names. They are also known as reserve words.
Eg. void, private, if, while etc.
Literals:
Items having fixed data values are referred to as Literals. They are also
known as Constants. Various types of literals available in Java are :
integer iterals
Floating literals
Boolean literals
Character literals
String literals
Null literals
Variable:
Operators: Operators are special symbols that perform specific operations on one, two, orthree
operands, and then return a result.
Operators Precedence
postfix expr++ expr
unary ++exprexpr+exprexpr~ !
multiplicative * / %
additive + shift <<>>>>>
relational <><= >= instanceof
equality == !=
bitwise AND &
bitwise exclusive OR ^
bitwise inclusive OR |
logical AND &&
logical OR ||
ternary ? :
assignment = += =*= /= %= &= ^= |= <<= >>= >>>=
Primitive Data Types:
A primitive type is predefined by the language and is named by a reserved keyword.
The eight primitive data types supported by the Java programming language are:
Use of import statement in java programming
The import statement in Java allows programmers to refer to classes which are declared in other
packages to be accessed without referring to the full package name.
a) single class from package by mentioning the class name specifically.
Eg.Import javax.swing.jOptionPane;
b. entire class by using * (asterisk) symbol in place of class name.
Eg.import javax.swing.*;
life of a variable in an application
1.Local variable: The variable which is declared inside a method and is only accessible inside
that method is called a local variable.
2. Global variable: If a variable is declare outside all methods, then its scope includes all the
methods and it is said to be a global variable.
Inheritance
Inheritance is the capability of one class to inherit properties from an
existing class.
Need of Inheritance: Inheritance helps in two ways:
(i) Code Reusability: Inheritance helps in adding new features to a
class without modifying it. A pre-existing class can be directly be
reused in a new class.
(ii) Helps in expressing relationship among classes
Types of Inheritance:
a) Single ( 1:1) :
b) Hierarchical (1:M) : When several classes inherit from the same class
c) Multilevel (1:1:1) : When a subclass is the base class of another
class.
Types of Inheritance:
d) Multiple Inheritance: When a class inherit from the several base
class.
Access Control of Inherited members :
Public, Private ,Protected,
steps required to execute a query in JBDC
Import the packages required for database programming.
2. Register the JDBC Driver.
3. Open a connection.
4. Execute a query.
5. Extract data from result set.
6. Clean up the environment.
Differentiate between Java and NetBeans
Java is both a programming language and a platform
whereas NetBeans is a free, open source,cross-paltform
IDE with built in support for java programming language.
ODBC and JDBC driver.
ODBC
odbc is open database connectivity
OBDC is for Microsoft
ODBC mixes simple and advanced features together and has complex options for simple queries
ODBC requires manual installation of the ODBC driver manager and driver on all client machines
JDBC
jdbc is java database connectivity
JDBC is for Java applications
JDBC is designed to keep things simple while allowing advanced capabilities when required
JDBC drivers are written in Java and JDBC code is automatically installable,
secure,and portable on all platforms
Advantages of JDBC
Provide Existing Enterprise Data
Simplified Enterprise Development
Zero Configuration for Network Computers
No Installation
Database Connection Identified by URL
What are containers or container controls?
Ans.A containers are a controls that can hold other controls within it e.g., a Frame(there can
be multiplecontrols inside a frame) or a label(it can hold an image and/or text) or simply
window (we can put somany controls on it). Controls inside a container are known as
child controls. The child controls canexist completely inside their containers. That means
we cans move them outside their container.
When we delete a container control, all its child controls automatically get deleted.