Java Program to Find LCM and GCD of Two Numbers

  • Write a program in java to find gcd and lcm of two given numbers using loop and recursion.

Given two integers, we have to find the lcm and gcd of two numbers. Before jumping into java program, here is the brief introduction of lcm and gcd od two numbers.

Java Program to Print Prime Numbers between 1 to 100

  • Java program to print all prime numbers between 1 to 100 using for loop.

In this java program, we have to print all prime numbers between 1 to 100. There are various methods of primality testing but here we will use a basic method of repetitive division.

Final Keyword In Java

final keyword in java is used to impose various restriction on variables, methods, classes and method parameters. final enforces different restrictions depending on the type of entity it is applied on.

Super Keyword in Java

super is a keyword in java which refers to the immediate parent class object. Unlike this reference which refers to current object, super refers to immediate parent class object.

this Keyword in Java

this is a keyword in java which can be used inside a method or a constructor to refers to the current object. Except in static methods, this keyword can be used in any method to refer to current object. this keyword can be used to refer to any member variable or member method of current class.

Java Static Variables and Methods

Static is a Non Access Modifier in java. It is mainly used to attach a Variable or Method to a Class. A static variables or methods belongs to a class rather than objects.

Java Packages

A package in java is a group of similar classes, interfaces, enumerations and sub-packages. It is also used to manage class files in hierarchical file systems to prevent naming conflicts, control access of class and to keep related classes and interfaces together in same directly.

Constructor in Java

A constructor is a special method inside a class which is invoked to create an object of that class. We can also write custom constructors to initialize an object. Not just initialization, you can do lots of things inside a constructor like calling another method, opening a file, updating a database etc.

Access Modifiers in Java

Java access modifiers are used to define the scope and accessibility of data member, method, constructor, classes with respective to other classes and members. In this tutorial we will learn about various access modifiers like private, public and protected and their effect on the scope and accessibility.

Class and Object in Java

Objects and Classes are two core concepts of object oriented programming. In OOPs, We design a program using classes and Objects. A programming language is said to be truly Object oriented programming language if everything is represented as Object. Here we will discuss about objects and classes in java programming language.