Arithmetic Operators and expression
Suddenly, we waved goodbye to 2019 has, 2020 Year of the Rat was with the spring tide rolling in. Not long ago, I was doing the second half of 2019 soft test (formerly known as: computer technology and software professional and technical qualification examinations) junior programmers test questions in the afternoon, I was in that place still a little confused, I find time to put down the test sites there again a review. I believe there are many small partners of this place is full of doubt, where Marshal unity to everyone for their answers:
the subject is such that knowledge mainly on the arithmetic operators and expressions (soft test presentation of the C language, I use is Java, the question of principle is the same):
public class Study{
public static void main(String args[]){
int h1=6,h2,h3,h4=8;
h3=h1;
h2=h1++;
System.out.println("h3="+h3+" h2="+h2+" h1="+h1);
System.out.println("h4="+h4);
System.out.print("h4="+ ++h4 +" ");
System.out.println("h4="+h4);
System.out.print("h4="+ --h4 +" ");
System.out.println("h4="+h4);
System.out.print("h4="+ h4++ +" ");
System.out.println("h4="+h4);
System.out.print("h4="+ h4-- +" ");
System.out.println("h4="+h4);
}
}
The resulting output is:
h3=6 h2=6 h1=7
h4=8
h4=9 h4=9
h4=8 h4=8
h4=8 h4=9
h4=9 h4=8