Java Virtual Method

In this tutorial you will learn about java virtual method or function. Java is a programming language which has never failed to let the programmer marvel in wonder. One such concepts of the java programming language are that of java virtual methods. Unlike other programming languages, java provides for a default support to the java virtual function. This means, all the methods other than private and the static methods, are by default virtual methods. Now, the question arises: what actually

Read more

Best Way to Learn Java for a Beginner

Here you will know what is the best way to learn java for a beginner. Programming is the new vogue and a vogue which can make you earn wonders and at the same time make you utilize the capabilities of your brain to the fullest. Learning new programming languages however can sometimes turn out to be challenging especially when the language is one which holds immense importance in various fields. Java is definitely one of those languages which most of

Read more

Java Program to Find LCM of Two Numbers

Here you will get java program to find lcm of two numbers. Finding LCM is one of the most basic mathematical calculations that are taught to students at their primary classes. Let’s review the basic concepts again. LCM stands for Least common multiple which simply means that it is a number that is divisible by all the given numbers. This number i.e., LCM of the given numbers is always greater than or equal to the largest of given numbers. This

Read more

Upcasting and Downcasting in Java

In this tutorial we are going to understand the concept of upcasting and downcasting in Java with example and learn about their use in the modern programming techniques. Upcasting in Java Upcasting basically refers to moving up in the class hierarchy. So what does the last line mean? We are going to understand this using a simple example where Game is the base class and Cricket and Chess are two of its subclasses. Game.java

Cricket.java

Chess.java

UpCasting.java

Read more

Perfect Number in Java

Here you will know about perfect number in Java with program and example. What is Perfect Number? The number said to be perfect number when sum of all positive divisors of that number excluding that number itself in divisors is equal to that number. Or, sum of all positive divisors of that number including that number is 2 times of the number. Key Points: The number of divisors of perfect number will be even. Most of the perfect numbers are

Read more

Java Program to Find GCD of Two Numbers Using Euclidean Algorithm

Here you will get java program to find gcd of two numbers using recursion and euclidean algorithm. Greatest Common Division (GCD) of two numbers is largest number that divides both of them completely. GCD is also called as Highest Common Factor (HCF). There are various ways to find GCD but Euclidean Algorithm is the most efficient way. Euclid’s algorithm GCD of two numbers a and b can be obtained by following algorithm. gcd (a, b) = gcd (a – b, b),

Read more

Static Keyword in Java

In this tutorial you will learn about static keyword in Java with example code. Static keyword in java mainly used for memory management process. In Java static keyword can be used in following cases. With Variables With Methods With Blocks With Nested Class Lets discuss each of them one by one. Static Keyword in Java Static Variable in Java We can declare static variable by simply writing static keyword before normal variable. Static variables are memory efficient as memory for

Read more
1 2 3 4