Programming
Languages
There
are
hundreds
of
computer
programming
languages,
some
are
historical
(i.e.,
not
many
acGve
users)
Each
language
is
designed
with
specic
features
to
implement
C++,
Java
Lisp
Perl,
Python,
R,
Ruby
Pascal
Fortran
COBOL
C
BASIC
What
Is
Java?
Similar
to
C/C++
Designed
with
a
goal
of
being
able
to
simulate
a
machine
virtually
%
is
called
a
prompt
It
nudges
the
user
to
type
a
command
%
% java HelloWorld
Hello, World!
An
Anatomy
Each
program
starts
with
public
class
followed
by
the
name
of
the
program,
called
a
class
name
1
2
3
4
5
HelloWorld.java
1
2
3
4
5
System.out.println
System.out.println(.
.
.)
prints
on
the
screen
the
symbols
appearing
within
the
double
quotes
verbaGm
and
then
a
carriage
return
Matching
Braces
1
2
3
4
5
3. CODE EDITING
Code
EdiGng
The
CSC120
labs
will
take
place
in
Ungar426
There
are
18
machines,
each
running
a
Unix-
like
operaGng
system
Three
recommended
code
ediGng
programs
vi,
emacs,
gedit
gedit
is
a
wysiwyg
editor
funcXon
vi
versus
emacs
(examples)
vi
emacs
Moving cursor
Arrow keys
Arrow keys
AlternaGve
(Leb,
Down,
Up,
Right)
h, j, k, l
0,
D,
a,
type
the
text,
and
C-k
and
then
type
the
text
then
esc
Beginning of line
C-a
End of line
C-e
/*
*/
Usually
for
comments
that
require
mulGple
lines
/**
*/
The
comments
appearing
this
way
can
be
shared
with
others,
called
javadoc
Comments
Example
Comments.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
* Class for showing comment examples
* Written by Mitsunori Ogihara
*/
public class Comments {
/**
* main method
* @param args
the arguments
*/
public static void main(String[] args) {
// There is only one line in the program
System.out.println(A code needs comments!");
System.out.println(A code needs indentation!);
}
}
Mitsu
Ogihara,
CSC120
/*
* Class for showing comment examples
* Written by Mitsunori Ogihara
*/
public class Comments {
/**
* main method
* @param args
the arguments
*/
public static void main(String[] args) {
// There is only one line in the program
System.out.println(A code needs comments!");
System.out.println(A code needs indentation!");
}
}
Mitsu
Ogihara,
CSC120