Site icon DataFlair

Java Program For Arithmetic Operators

Get Job-ready: Java Course with 45+ Real-time Projects! - Learn Java

Program 1

class TestData1
{
  public static void main(String args[])
 {
    byte a=50,b=30;
    System.out.println("Before swaping" + a + " " +b); 
      a=(byte)(a+b);
      b=(byte)(a-b);
      a=(byte)(a-b);

    System.out.println("After swaping" + a + " " +b);    


 }
}

 

Exit mobile version