import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println(“Please enter a number, for which you want to write a table:”); int number = scan.nextInt(); for(int count=1; […]
Write a program to find length and sum of digits in a number.
Write a program to find digits in a number.
What is and how to use the Constructors in JAVA?
Why constructor is needed? It can be a slow process to initialize all variables of a class, each time when an object is created. Because the requirement of initialization is very common, JAVA allows objects to initialize themselves when they are created. This automatic initialization is performed through the use […]
What is and how to use classes in JAVA?
Arrays
Type Conversion and Casting
There are two types of conversion in Java as: Implicit conversion Explicit conversion Implicit Conversion: Implicit conversion is also known as automatic conversion. When one type of data is assigned to different type of variable then automatic type conversion will take place if the following conditions are met. both type […]
Data Types and Variables
How to use control statements in Java and their example
There are mainly three categories of control statement in Java as: Selection Statement Iteration Statement Jump statement § Selection Statement: There are two selection statements as: if statement: It is conditional branch statement. It can be used to route program execution through two different paths. Syntax: if(condition) { statement; […]