Data Type of Expressions & Increment/Decrement Operators

 package com.company;

import java.util.Scanner;

public class tuts {
public static void main(String[] args) {
int a = 4;
int b = a;
// System.out.println(b++);
// System.out.println(b);
// System.out.println(a);

int y = 7;
int x = ++y * 8;
System.out.println(x);

char ch = 'a';
System.out.println(++ch);
// Output of character increment is + to the character like a will become b
}
}

Comments

Popular posts from this blog

Creating a Thread by Extending Thread class

Constructors from Thread class in Java