Besic Synthetical Constructor in Java
Besic Synthetical Constructor in Java
Features of java:-
List any eight features of Java.
Features of Java:
1. Data Abstraction and Encapsulation
2. Inheritance
3. Polymorphism
4. Platform independence
5. Portability
6. Robust
7. Supports multithreading
8. Supports distributed applications
9. Secure
10. Architectural neutral
11. Dynamic
Describe any four features of Java.
(Note: Any four features shall be considered)
Features of Java:
i. Java is an object oriented language:- It follows all the principles of
object oriented programming namely inheritance, polymorphism
and abstraction. Multiple inheritance is possible with the concept
of interface
ii. Java is both compiled and interpreted:- Most of the programming
languages either uses a compiler or an interpreter. Java programs
are to be compiled to get an intermediate byte code (a .class file)
and then interpreted making it more secure and platform
independent.
iii. Java is secure:
Java does not use pointer.
Java programs run inside a virtual machine
Classloader adds security by separating the package for the
classes of the local file system from those that are imported
from network sources
Bytecode Verifier checks the code fragments for illegal code
that can violate access right to objects
Security Manager determines what resources a class can access
such as reading and writing to the local disk
iv. Robust: Java uses strong memory management. The lack of
pointers avoids security problem. There is automatic garbage
collection in java. There is exception handling and type checking
mechanism in java
v. Architecture-neutral: There is no implementation dependent
features e.g. size of primitive types is fixed
vi. Platform independent and Portable: java byte code can be carried
to any platform
vii. Distributed: Distributed applications can be created in java. RMI
and EJB are used for creating distributed applications. We may
access files by calling the methods from any machine on the
internet
viii. Multithreaded: A thread is like a separate program, executing
concurrently. We can write Java programs that deal with many
tasks at once by defining multiple threads. The main advantage of
multi-threading is that it doesn't occupy memory for each thread. It
shares a common memory area. Threads are important for multimedia,
Web applications etc.
Class: A class is a user defined data type which groups data
members and its associated functions together.
Object: It is a basic unit of Object Oriented Programming and
represents the real life entities. A typical Java program creates
many objects, which as you know, interact by invoking methods.
Java tokens
3 Character char 2
for eg.
class Twodarray
{
public static void main(String[] args)
{
int[][] arr = { { 1, 2 }, { 3, 4 } };
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2; j++)
{
System.out.print(arr[i][j] + " ");
}
System.out.println();
}
}
}
Output:
12
34