偶然搜到Mark Dexter的这个免费视频(http://eclipsetutorial.sourceforge.net/totalbeginner.html)。够傻瓜,够直观。慢慢习之。
Lesson 01 – Create Your First Java Class
- Create Java project in Eclipse
- Create Java package
- Introduce classes and objects, naming conventions
- Write a simple Java class (Person)
- Create Java project in Eclipse
Java Project contains source code and relected files for building a Java program.
File / New / Project / Java / Java project / Next / “TotalBeginner” (project name) / Next / Finish.
2. Create Java package
Java Package contains related class files and allows you to use short-cut class names (用Ctrl-Space)。
RC (right click) src / New / package / org.totalbeginner.tutorial (name) /
3. Introduce classes and objects, naming conventions
Classes in intial caps (e.g.. Person, Book);
Variables and method in lower case (e.g. . maximumBooks, name).
4. Write a simple Java class (Person)
1 package org.totoalbeginner.tutorial;
2
3 public class Person {
4
5 // fields
6 private String name; // name of the person
7 private int maximumBooks; // most books the person can check out
8
9 // constructors
10 public Person() {
11 name = "unknown name";
12 maximumBooks = 3;
13 }
14
15 }