-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVariablesExample.java
More file actions
42 lines (27 loc) · 861 Bytes
/
VariablesExample.java
File metadata and controls
42 lines (27 loc) · 861 Bytes
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
32
33
34
35
36
37
38
39
40
41
42
package com.vlad.basics;
public class VariablesExample {
public static void main (String[] args) {
System.out.println("Переменные и типы данных.");
int age;
age = 25;
System.out.println("Your age is: " + age + " years old.");
//byte - 1 byte используется от -128 до 127
//short - 2 byte используется от -32768 до 32767
//int 4 byte
//long 8 byte
byte num1 = 127;
//float
//double
float num2 = 4.12f;
double num3 = 5.324f;
System.out.println(num2 + num3);
//char
//String
char c = 'K';
String user_name = "Amadeika";
System.out.println(c);
System.out.println(user_name);
//boolean
boolean isHappy = false;
}
}