Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Developing and running Java programs using NetBeans Your browser does not support Javascript. You should still be able to navigate through these materials but selftest questions will not work. Getting started with Java Table of Contents Introduction Terminology Developing and running Java programs A simple Java program Developing and running Java programs without using IDE Developing and running Java programs using NetBeans Some basic language features Summary Other useful readings: Developing and running Java programs using NetBeans For the rest of the module we will develop our programs using NetBeans, which is an IDE that incorporates the Java compiler, the Java interpreter and a number of other tools together with file and project management for developing and executing Java programs. In unit1, you learned how to create a project and a use case diagram in NetBeans. In this unit, we will explain how to create and run Java programs in NetBeans. In NetBeans, we normally work with projects. For example, you can create a project for all the programs related with this unit, and later on you can create a project for your assignment. When a project is created, we need to tell NetBeans the name of the project and the location for storing all the files. Student activity 2.1: Following this link http://www.netbeans.org/kb/60/java/quickstart.html for a tutorial on how to create a project, a java program and how to compile and run it. After completing the above activity, you should have a Java program called HelloWordApp. Now let's try to create your own Java program. Student activity 2.2: Create the following Welcome program using NetBeans in a project called OOPjava. //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } } When you create the project, make sure that you select a suitable project location and the correct name for the class, e.g. startjava.Welcome. See the screen shot below as an example. staratjava is the name of the package and Welcome is the name of the class. We will explain more about these concepts later in this unit. After clicking on Finish, you should see something like the following. Enter the program code in the "main" method. Compile and run the program. The "main" method is the method that the Java run time system will first trigger when running a Java application program. To compile or to run the program, you can either do it from the IDE menu as explained in Student activity 2.1, or you can compile or run a particular file. Move the cursor to the file you want to compile or run, right click the mouse and choose "Compile File" or "Run File" as shown in the screen shot below. After running the program, you should see something like the following. (Optional) For readers who have some experience with IDEs, you may find the screen casts on "Java editing enhancement" from the Netbeans website interesting: http://www.netbeans.org/kb/60/java/editor-screencast.html If you are new to Netbeans, this maybe too detailed for you at this stage.