Write a program to create table of any number.

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.

Lets first figure out the logic of getting digits of a number, once we get the digit we can count them and also find addition. suppose we have a digit= 543374. lets figure out it as; Step 1: reminder = 543374%10 = 4 digit =543374/10 =54337     (1 digit) Step […]

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 […]

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; […]