Write a program in java to find out multiplication of a given number without using multiply sign?

class Multiply {                 public static void main(String arg[])                 {                                 int a=3,b=9,s=0,i=0;                                 for(i=1;i<=b;i++)                                                 s=s+a;                                 System.out.println(s);…

Read More

Write a program in java to demonstrate increment and decrement operator?

class IncrementDecrement {                 public static void main(String arg[])                 {                                 int a=2,b=5;                                 System.out.println(++a+ ++b);                                 System.out.println((–a- –b)+…

Read More

Write a program in java to find sum of only even number and its average from three digits number?

class Sum {                 public static void main(String arg[])                 {                                 int a=258,d=0,s=0,c=0;                                 d=a%10;                                 if(d%2==0)                                 {…

Read More

Write a program in java to find to greatest and smallest number between three number?

class GreatestSmallest {                 public static void main(String arg[])                 {                                 int a=5,b=7,c=9;                                 if((a>b)&&(a>c))                                 {                                                 System.out.println(“Greatest…

Read More

Write a program in java to demonstrate ternary operator?

class TernaryOperator {                 public static void main(String arg[])                 {                                 int a=9,b=7;                                 int max=(a>b)?a:b;                                 System.out.println(max);                …

Read More

Write a program in java to demonstrate Default constructor?

class DefaultConstructor {                 int a,b;                 public void display()                 {                                 System.out.println(a);                                 System.out.println(b);                 }                 public…

Read More

Write a program in java to demonstrate overloading?

class OverLoading {                 String s1;              //Instance member/Attributes                 int a,b;  //Instance member/Attributes                 public OverLoading()                 {                                 a=7;…

Read More

Write a program in java to demonstrate upcasting?

class UpCasting {                 public static void main(String arg[])                 {                                 int a=9;                                 long l=a;                                 System.out.println(l);…

Read More