Java-Day1 by Bunny
Java-Day1 by Bunny
• Simple:
• Java syntax is based on C++ (so easier for programmers to learn it after C++).
• Java has removed many complicated and rarely-used features, for example,
explicit pointers, operator overloading, etc.
• Object Oriented
Object-oriented programming (OOPs) is a methodology that simplifies software
development and maintenance by providing some rules.
• Basic concepts of OOPs are:
• Object
• Class
• Inheritance
• Polymorphism
• Abstraction
• Encapsulation
• Platform Independent
• Secured
Java is best known for its security. With Java, we can develop virus-free systems.
Java is secured because:
• No explicit pointer
• Java Programs run inside a virtual machine sandbox
• Robust
• Architecture Neutral
There are no implementation dependent features.
• In C programming, int data type occupies 2 bytes of memory for 32-bit architecture and
4 bytes of memory for 64-bit architecture. In java it occupies 4 bytes of memory for both
32 and 64-bit architectures in Java.
• Portable
• Java is portable because it facilitates you to carry the Java bytecode to any platform. It
doesn't require any implementation.
• High-performance
• The Java bytecode was carefully designed so that it would be easy to translate directly
into native machine code for very high performance by using a just-in-time compiler.
• Distributed
• Java is designed for the distributed environment of the Internet, because it handles
TCP/IP protocols. RMI and EJB are used for creating distributed applications. This
feature of Java makes us able to access files by calling the methods from any machine
on the internet.
• Dynamic
• Java programs carry with them substantial amounts of run-time type information that is
used to verify and resolve accesses to objects at run time. This makes it possible to
dynamically link code in a safeMrs.and
Soniyaexpedient manner.
Sharma [email protected]
Java’s Magic : Bytecode
• The output of Java compiler is not executable code rather, it is bytecode.
• Bytecode allows Java to solve both the security and the portability problems.
• Bytecode is executed by the Java run-time system, which is called as Java Virtual
Machine (JVM).
• The Just In Time compiler, compiles the code as needed, during execution, this gives
significant performance boost.
Mrs. Soniya Sharma [email protected]
Java’s Magic : Bytecode
• JRE provides a runtime environment to your program for it's execution. As soon as you
start running your program using java command, the job of JRE starts and it ends when
either the program ran successfully or any error is thrown.
• JRE is also a software package which contains JVM, runtime libraries and other
supporting files needed to run a program.
class Simple{
public static void main(String args[]){
System.out.println(“Welcome To Lets Upgrade!!!");
}
}
Program 2
OUTPUT
• A data type in Java represents the size and different values that can be stored in a
variable.
• There is no limit on the length of a variable name but by convention, it should be between 4
to 15 chars.
• And (&&)
• OR (||)
• Not(~)
• If Construct
Output
Types of Loops
www.linkedin.com/in/soniya-p-sharma