There are three main stages in the life cycle of a java program. They are: Editing the program. Compiling the source code. Executing the byte code.
Java programs normally go through five phases—edit, compile, load, verify and execute.
Life Cycle of a Thread
When a thread lies in the new state, its code is yet to be run and hasn't started to execute. Runnable State: A thread that is ready to run is moved to a runnable state. In this state, a thread might actually be running or it might be ready to run at any instant of time.
Java provides 4 levels of access modifiers. This means that you can modify access to a variable, method or a class in 4 ways. These 4 ways are private, public, protected and default.
JAVA is based on object-oriented programming.
An object is an actual entity that occupies space in the memory. OOPS moves around its four most important pillars. These are; Inheritance, Polymorphism, Abstraction, and Encapsulation. Let's discuss all these in brief.
Java architecture consists of three main components and those are JRE(Java Runtime Environment), JDK(Java Development Kit), and JVM(Java Virtual Machine).
The four principles of object-oriented programming (abstraction, inheritance, encapsulation, and polymorphism) are features that - if used properly - can help us write more testable, flexible, and maintainable code.
API (Application Programming Interface) in Java is a set of predefined rules and specifications for accessing a web-based software application or web tool. It offers a way for developers to interact or integrate two different systems, allowing for easy exchange of data and communication.
Typically, there are three levels of Java knowledge, namely Java, core Java, and advanced Java. Hence, both core Java and advanced Java differ in terms of knowledge. Java – The basic level.
Java, being a platform-independent programming language, doesn't work on the one-step compilation. Instead, it involves a two-step execution, first through an OS-independent compiler; and second, in a virtual machine (JVM) which is custom-built for every operating system.
A method in Java is a block of code that, when called, performs specific actions mentioned in it. For instance, if you have written instructions to draw a circle in the method, it will do that task. You can insert values or parameters into methods, and they will only be executed when called.
Data types specify the different sizes and values that can be stored in the variable. There are two types of data types in Java: Primitive data types: The primitive data types include boolean, char, byte, short, int, long, float and double.
An array is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created. After creation, its length is fixed. You have seen an example of arrays already, in the main method of the "Hello World!" application.
APIs are important software components bundled with the JDK. APIs in Java include classes, interfaces, and user Interfaces. They enable developers to integrate various applications and websites and offer real-time information. The following image depicts the fundamental components of the Java API.
The Model View Controller (MVC) design pattern specifies that an application consist of a data model, presentation information, and control information. The pattern requires that each of these be separated into different objects. MVC is more of an architectural pattern, but not for complete application.
Polymorphism means "many forms", and it occurs when we have many classes that are related to each other by inheritance. Like we specified in the previous chapter; Inheritance lets us inherit attributes and methods from another class. Polymorphism uses those methods to perform different tasks.
The Java Development Kit (JDK) is a cross-platformed software development environment that offers a collection of tools and libraries necessary for developing Java-based software applications and applets.
A typical structure of a Java program contains the following elements: Documentation Section. Package Declaration. Import Statements. Interface Section.
A thread is a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently. Every thread has a priority. Threads with higher priority are executed in preference to threads with lower priority.
Abstraction, encapsulation, polymorphism, and inheritance are the four main theoretical principles of object-oriented programming. But Java also works with three further OOP concepts: association, aggregation, and composition.