Skip to content

Commit 9956f58

Browse files
author
ゼクロ
committed
part-02 merge
2 parents a815f20 + d176b7b commit 9956f58

File tree

2 files changed

+73
-2
lines changed

2 files changed

+73
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
|------|-------|-------|--------|
1818
| 0 | Einstieg | [Video](https://www.youtube.com/watch?v=tTXHwWcUrDE) | *n/a* |
1919
| 1 | Projekt erstellen & deployen | [Video](https://youtu.be/Lap1SIzYcNk) | [Branch](https://github.com/zekroTJA/JavaTutorial/tree/part-01) |
20+
| 2 | Variablentypen & Access Types | *soon* | [Branch](https://github.com/zekroTJA/JavaTutorial/tree/part-02) |

src/main/java/Main.java

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,78 @@
11
public class Main {
22

3+
/*
4+
* 1. Datentypen
5+
* 2. Keywords, Access Types
6+
* 3. Methods
7+
* */
8+
9+
/*
10+
<--[ Variablen Typen ]-->
11+
*/
12+
short myShort = 2;
13+
static int myInt = 123;
14+
long myLong = 123123123123l;
15+
16+
float myFloat = 1.3456f;
17+
double myDouble = 1.2346;
18+
19+
String myString = "Hey! This is my string!";
20+
21+
/*
22+
<--[ Arrays ]-->
23+
*/
24+
float myFloatArray[] = {1, 2, 3, 1.3456f};
25+
String myStringArray[] = {"hey!", "ho!"};
26+
int myIntArray;
27+
28+
/*
29+
<--[ Methoden / Getter & Setter ]-->
30+
*/
31+
32+
private static int myPrivateInt;
33+
34+
public static int getMyPrivateInt() {
35+
return myPrivateInt;
36+
}
37+
38+
public static void setMyPrivateInt(int setter) {
39+
myPrivateInt = setter;
40+
}
41+
42+
43+
public int myPublicInt;
44+
45+
/*
46+
<--[ Access Type: 'final' ]-->
47+
*/
48+
49+
private static final String MYSTATICFINASTRING = "Hey ho";
50+
51+
52+
/*
53+
Static Voids
54+
*/
55+
56+
public static void hello(String name, String secondname) {
57+
System.out.println("Hello, " + name + " and " + secondname);
58+
}
59+
360
public static void main(String[] args) {
4-
System.out.println("Hello World!");
5-
System.out.print("This is my first Java Program!");
61+
// System.out.println("Hello World!");
62+
// System.out.print("This is my first Java Program!");
63+
64+
hello("Ringo", "Martin");
65+
66+
// MYSTATICFINASTRING = "asd"; -> ERROR
67+
68+
System.out.println(Integer.toString(myInt));
69+
70+
setMyPrivateInt(17);
71+
72+
System.out.println(getMyPrivateInt());
73+
74+
int myNewInt = getMyPrivateInt();
675
}
776

877
}
78+

0 commit comments

Comments
 (0)