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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
1
00:00:00,130 --> 00:00:02,420
So now that we know, we saw what happens under
2
00:00:02,420 --> 00:00:04,570
the hood, and as I said, don't worry about it if
3
00:00:04,570 --> 00:00:06,689
you don't care about that part. Now we can go back
4
00:00:06,689 --> 00:00:09,850
to Eclipse, and we can start creating a package. A package
5
00:00:09,850 --> 00:00:13,125
is basically a way of organizing your classes into a
6
00:00:13,125 --> 00:00:17,015
hierarchy. In this case, I'm going to specify the package name as
7
00:00:17,015 --> 00:00:21,350
edu.gatech, which means that I'm creating really two packages, a package
8
00:00:21,350 --> 00:00:25,480
gatech inside package edu. And I can start creating classes inside
9
00:00:25,480 --> 00:00:28,770
my packages. So here, I can use the contextual menu, select
10
00:00:28,770 --> 00:00:32,055
New>Class, and I'll get another wizard that will allow me to
11
00:00:32,055 --> 00:00:35,160
specify the name of the class. I'm not very creative here,
12
00:00:35,160 --> 00:00:38,250
so I'm just going to call it Hello World. There's many other parameters
13
00:00:38,250 --> 00:00:41,710
you can set, and in particular, you can define whether you
14
00:00:41,710 --> 00:00:45,450
want a main method in your class. Where having a main
15
00:00:45,450 --> 00:00:48,460
method means that your class can be the main class in
16
00:00:48,460 --> 00:00:50,850
your project, can be the one that is run when you run
17
00:00:50,850 --> 00:00:54,340
your project. After we click the button, the Finish button, we,
18
00:00:54,340 --> 00:00:56,859
we get the class. So we also get template code for the
19
00:00:56,859 --> 00:00:59,604
class, as you can see here, so we go to the editor
20
00:00:59,604 --> 00:01:02,120
function, you can see that there is a to do. Where you
21
00:01:02,120 --> 00:01:05,019
have to put your code, and here we are simply, basically printing,
22
00:01:05,019 --> 00:01:08,370
you know, the typical first program. We just going to print Hello World
23
00:01:08,370 --> 00:01:11,180
in Java. And something you can note is that as we are
24
00:01:11,180 --> 00:01:16,370
typing, Eclipse gives us a auto complete suggestions, which is very helpful.
25
00:01:16,370 --> 00:01:19,650
For example, in case you don't remember the exact syntax,
26
00:01:19,650 --> 00:01:22,190
or the method, or you don't remember the parameters of the
27
00:01:22,190 --> 00:01:24,470
method. Which is, you know, often the case especially where you
28
00:01:24,470 --> 00:01:27,590
work with large libraries. So having that feature can really, really
29
00:01:27,590 --> 00:01:30,050
help you. So now if we want to run our code
30
00:01:30,050 --> 00:01:33,380
we can either click on the button up here, or we
31
00:01:33,380 --> 00:01:37,960
can right-click in the Call window and select Run As Java
32
00:01:37,960 --> 00:01:41,370
Application. And if we do that, Eclipse will run our tool,
33
00:01:41,370 --> 00:01:45,650
and it will create, as you can see here, a console view that basically contains
34
00:01:45,650 --> 00:01:49,790
the textual output of my program. And as expected, the output is Hello World.
|