140 likes | 320 Views
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
E N D
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
Creating a program • A Java program is nothing more than a sequence of characters stored in a file with a .java extension • You can use any text editorfor this task, or you can use one of the more sophisticated program development environments
Compiling a program • Programming languages are designed to be best understoodby theprogrammer • The computer’s language is far moreprimitive than Java • A compiler is an application that translates a program from theJava language to a language more suitable for executing on the computer. • The compilertakes a file with a .java extension as input (your program) and produces afile with the same name but with a .class extension (the computer-language version)
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 yourcomputer 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