Last active
April 7, 2017 20:03
-
-
Save stden/a5bfc03a25cbc82019e77885f5dbf38d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Java1_FirstApplication { | |
public static void main(String[] args) { | |
System.out.println("Hello, world!"); | |
int a = 4; | |
// declaration (объявление) | |
int b; | |
// initialization (инициализация - задание значения) | |
b = 7; | |
// ПРИМИТИВНЫЕ ТИПЫ | |
// ЧИСЛА | |
// целые | |
int i = 2; // 4 | |
int y = 0x9; | |
long l = 45; // 8 | |
long l1 = 4000000000L; | |
short srt = 12; // 2 | |
byte br = 12; // 1 | |
// char | |
System.out.println('A'); | |
System.out.println('\u0041'); | |
char c = 65; | |
char c1 = 'A'; | |
char c2 = '\u0041'; | |
System.out.println(c); | |
System.out.println(c1); | |
System.out.println(c2); | |
// дробные числа | |
double d = 9.8; | |
double d1 = 9.8d; | |
float f = 9.8f; | |
// boolean - логическое значение | |
boolean t1 = true; // истина, правда, "да" | |
boolean t2 = false; // ложь, "нет" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment