GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JavaTutorial/src/F009_ArithmeticExpressions.java at master · windweb/JavaTutorial

Expand file tree

/

F009_ArithmeticExpressions.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
31 lines (24 loc) · 842 Bytes
/

F009_ArithmeticExpressions.java

Copy path

File metadata and controls

31 lines (24 loc) · 842 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
public class F009_ArithmeticExpressions {
public static void main(String[] args) {
int result1 = 10 / 3;
System.out.println(result1); // result = 3
double result2 = (double) 10 / (double) 3;
System.out.println(result2); // result2 = 3.3333333333333335
int x = 1;
x++; // x = x + 1
// ++x; // x = x + 1
System.out.println(x); // x = 2
int y = x++;
System.out.println(y);
// ++x; отличается от x++;
// переменная x не увеличивается, а просто увеличивается
int z = 10;
System.out.println(z);
int w = ++z;
System.out.println(z);
int t = z++;
System.out.println(z);
System.out.println(w);
System.out.println(t);
}
}
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.