IMPORTANT THINGS TO NOTE IN JAVA

Below are some of the most important things one must take note of when preparing for a java examination

A static integer is a variable that is associated with a class, rather than with an instance of the class. It means that the variable is shared among all instances of the class, and can be accessed directly using the class name, rather than through an instance of the class. Additionally, the value of a static integer remains the same across all instances of the class, and can be modified by any instance or by the class itself. The default value of a static value is 0.

Inheritance is a mechanism in object-oriented programming that allows a class (child/subclass) to inherit properties and behaviors (methods and variables) from another class (parent/superclass).

Private, public, and protected are access modifiers that define the visibility of class members (variables, methods, and inner classes) from other classes.

-Private members are only visible within the same class, and not accessible from any other class.

-Public members are visible to all classes, regardless of the package they belong to.

-Protected members are visible within the same package and subclasses of the class.

Final is a keyword that can be used to define a constant or an entity that cannot be changed or overridden.

An interface contains only constant fields (declared as public static final) and method signatures (declared as public abstract).

In Java, an interface is a collection of abstract methods and constants that define a set of rules or contracts that concrete classes must implement. An interface can’t implement another interface.

The try-catch block is used to handle exceptions in Java programs. It allows you to write code that can handle runtime errors that may occur during the execution of your program.

The finally block is a block of code in Java that is associated with a try block and is executed after the try block executes whether an exception is thrown or not. The finally block is usually used to perform cleanup operations such as closing streams, releasing resources, or restoring the program state

A method is a block of code that performs a specific task and can be called by other parts of the program.

An argument is a value passed to a method when it is called.

A parameter is a variable in a method definition that is used to accept an argument value passed to the method.

A class is a blueprint for creating objects that defines the properties and behaviors of that object type.

A package is a way of organizing related classes and interfaces into a single unit, making it easier to manage and reuse code.

A constructor is a special method in Java that is used to initialize objects of a class. It has the same name as the class and is executed when an object is created. The main purpose of a constructor is to set initial values for the object’s instance variables, but it can also perform other tasks such as validating input, allocating memory, or establishing connections to resources.

Bytecode is the compiled code that is generated by the Java compiler and is executed by the Java Virtual Machine (JVM). It is a platform-independent code that can run on any system that has a JVM installed. The bytecode is not specific to any hardware or operating system, and it provides a layer of abstraction that allows Java programs to run on multiple platforms.

Polymorphism is a fundamental concept in object-oriented programming, which refers to the ability of an object to take on multiple forms. In Java, polymorphism is achieved through method overloading and method overriding.

Garbage collection in the context of Java is the automatic process of freeing up memory occupied by objects that are no longer being used by the program. It is performed by the Java Virtual Machine (JVM) as a background process, and the developer doesn’t have to manually allocate or deallocate memory for objects

A primitive data type in Java is a basic data type that is built into the language and not derived from any other type. There are eight primitive data types in Java, which are:

byte

short

int

long

float

double

char

Boolean

An applet is a small program written in Java programming language that can be embedded in a web page and can be executed within a web browser

To answer some questions on the above. Tap on this post

Leave a Reply

Your email address will not be published. Required fields are marked *