Unix/MSDOS Command summary
- display listing of all source files: "cat P1/*.java *.java | more"
- redirect a file to X1.txt: "cat P1/*.java *.java > X1.txt"
- package compile: "javac -d ./P1 ./P1/I*.java ./P1/A*.java ./P1/C*.java"
- application execute: "java -g T1"
- application execute with jar(requires Manifest.mf): java -jar eecs382apiP1.jar"
- application webpage document: "javadoc *"
- application archive: "jar cvf eecs382apiP1.jar *"
- application table of contents: "jar tvf eecs382apiP1.jar"
- application unarchive: "jar xvf eecs382apiP1.jar"
- application make (looks for build.xml): "ant"
- directory listing: "ls -l"
- directory listing of subdirectries: "ls -Rl"
- directory listing (msdos): dir
- make a directory: "mkdir dirname"
- remove a directory: "rmdir dirname"
- erase a file (unix): "rm file"
- erase subdirectories (unix): "rm -fr filenames"
- erase a file (msdos): "erase filename"
- copy a file (unix): "cp -p filesrc filedest"
- copy a file (msdos): "copy filesrc filedest"
Comments about Javadoc's first sentence:
- A Javadoc comment begins with "/**" and ends with "*/"
- The first sentence in this comment is terminated by a period.
- The first sentence of each doc comment should be a summary sentence,
containing a concise but complete description of the declared entity.
- javadoc copies this first sentence to the member summary at the top of the HTML page.
- This sentence "can only" end with period that is followed by a blank,
tab, or line terminator, or at the first standalone tag.
- Or else a javadoc error message occurs: "warning - The first sentence is interpreted to be..."
- This means, avoid parenthesis "(" or ")" symbols or numbers at the beginning of the second sentence.
- Second sentence is best when it starts with a html tag or alphabetic character.
- The second sentence can begin with or contain html tags.
- The first sentence "must" not have html tags.
- Starting with Javadoc 1.4, the leading asterisks are optional.
- Blank lines should use the html paragraph tag to seperate lines (i.e. <P> ).
- The first line that begins with an "@" character ends the description.
- Insert a blank comment line between the description and the list of tags, as shown.
- Don't put html tags in the first sentence.
Comments about Interfaces:
- A package is a collection of related classes and interfaces
providing access protection and namespace management.
- If the keyword public is not included in the class or
abstract class it is considered package private. Classes
can be only seen outside a package when using the public keyword
before the class declaration.
- An interface is declared using the keyword interface.
- Interfaces should deal with the services provided by an object, not its data.
- Sun Definition: An interface is a named collection of method definitions
(without implementations).
- Interfaces provide for multiple inheritance as well as
information hiding and code re-use.
- An interface is a totally abstract class: An interface
cannot implement any methods whereas an abstract class can
implement default methods.
- All interface methods are implicitly abstract and public,
regardless of what you write in the interface definition.
- Since, the interface itself is already abstract.
It might be possible to write: public abstract interface I1{}.
But there's no point, since it's redundant.
- An interface is not part of the any class hierarchy.
- A class can implement many interfaces
but can only have one superclass (i.e. extends supperclass).
- Any additional inheritance (i.e. multiple inheritance)
is achieved through implementation of interfaces.
- Field variables are cannot be used within interfaces.
- Interfaces cannot directly model classes
because they do not allow method implementations (i.e. behaviors)
or field variables.
- Interface field variables are emulated by using wrapper
methods for getting and setting the variables.
- Abstract an concrete classes can declare field variables.
- Unrelated classes can implement the same interface:
For example, public class F1 implements I1 { }
and public class G1 implements I1, I5 { }
- An interface may extend zero or more interfaces if it likes,
but it cannot extend a class, because then it would inherit functionality,
and interfaces cannot have functionality (i.e. cannot implement any methods).
They can only talk about it.
- It is possible to place widely used constants in an interface.
If a class implements such an interface, then the class can refer
to those constants without a qualifying class name.
- Interface constants which are implicitly
"public", "static" and "final".
- Interface constants were a popular technique in the early days
of Java, but now many consider it ugly use of interfaces,
since interfaces should deal with the services provided by an object, not its data.
syntax examples:
[public][abstract|final] class classname [extends superclass] [implements interface1, ...]
{ [fieldlist;]
[constructorlist;]
[methodlist;]
}
class point {
//field list::= [static][final][public|private|protected] fieldtype fieldname [assignment];
int g; //default public
protected int h;
private int x, y; // coordinates of the point
public static final int zero =0; //constant
// constructor::=[public|private|protected] classname ([paramlist]){ [statementlist;] }
public point() { x=0; y=0; } // no-argument constructor method
// constructor method
public point(int ix, int iy) { x=ix; y=iy; } //this.y=iy; also works
//method
// [static][final][public|private|protected] returntype methodname [paramlist] { [statementlist;] }
// [protected void finalize() throws Throwable{ }; }
public void setxy(int ix, int iy) { x=ix; y = iy; }
public int getx() { return x; }
public int gety() { return y; }
public String toString() {
return "[" + x + ", " + y + "]";
}
public String getname() {
return "point";
}
}