What is JAVA?
Java is a high-level, object-oriented programming language that is designed to be platform-independent, meaning that code written in Java can run on any device that has a Java Virtual Machine (JVM). It was developed by Sun Microsystems in the mid-1990s and is widely used for building applications, ranging from mobile apps to large-scale enterprise systems. Key features of Java include:
1. **Object-Oriented**: Promotes modularity and reusability through classes and objects.
2. **Platform-Independent**: Java code is compiled into bytecode, which can be executed on any platform that has a JVM.
3. **Strongly Typed**: Java enforces strict type checking at both compile-time and run-time.
4. **Automatic Memory Management**: Uses garbage collection to manage memory automatically.
5. **Rich Standard Library**: Offers a vast array of libraries and frameworks for various functionalities.
Java is popular for its versatility, performance, and robustness, making it a preferred choice for many developers.
There are two components in java programs.
1. function.
main void(){
}
2.class.
Class main {
void main(){
}
}
The main code in java program .
=> System.out.print("Hello Worlds");
The output of above code = Hello Worlds
There are three condition of java program.
1. Print Hello Worlds in same line
Use simple Print
CODE = System.out.print("Hello Worlds");
OUTPUT = Hello Worlds
2. Print Hello Worlds in next line.
Use Println
CODE = System.out.println("Hello Worlds");
OUTPUT= Hello Worlds
3. Print Hello Worlds in next line.
Use "\n"(Back slac)
CODE = System.out.print("Hello Worldsln");
OUTPUT= Hello Worlds