CENG 161 Introduction to Computer Science + Lab.

farrightΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 2 μήνες)

292 εμφανίσεις

CENG 161


Introduction to Computer Science

Instructor: Dr. Nurdan SARAN

Lab Assistant: Arzu Burçak Sönmez

Requirements


To write your first program, you'll need:


The Java SE Development Kit


For Microsoft Windows, Solaris OS, and Linux:
Java SE Downloads page


The NetBeans IDE


For all platforms:
NetBeans IDE Downloads page


Developing a Java program

Creating a program



A Java program is nothing more than a sequence of
character
s
stored in a file with a
.java
extension



You can use any
text editor

for this task, or you can use
one of the more sophisticated program development

environments

Developing a Java program

Compiling a program


Programming
language
s are

designed to be best
understood

by the

programmer


The computer’s language is far more

primitive than
Java


A
compiler is an application that translates a
program from the

Java language to a language more
suitable for executing on the computer.


The compiler

takes a file with a
.java
extension as
input (your program) and produces a

file with the
same name but with a
.class
extension (the
computer
-
language version)


Developing a Java program

Executing a program


Once you compile the program, you can run it



Your computer follows your instructions



A part of
the Java system known as the
Java Virtual
Machine (the JVM) directs your

computer to follow
your instructions


Create an IDE Project


Launch the NetBeans IDE.


On Microsoft Windows systems, you can use the
NetBeans IDE item in the Start menu


In the NetBeans IDE, choose File
-
>

New
Project.






Create an IDE Project


In the New Project wizard, expand the Java category and
select Java Application as shown in the following figure:


Create an IDE Project


In the Name and Location page of the wizard, do the following
(as shown in the figure below):


Create an IDE Project


The project is created and opened in the IDE.

Your First Program



This is a simple Java code



Write the code and run it
in order to see what
happens



The showMessageDialog Method