|
-
December 16th, 2005, 03:32 PM
#2
a) lack of basic information necessary when learning java (i.e. how to compile a file, how to name a file, etc.)
b) the structure in which the information is presented (presenting strings prior to introducing primitive data types)
c) errors in example code (strings are not compared using operators, the equals, compareTo, and etc. methods are used)
d) the actual information presented is missing key java syntax explanations (such as import statements, the declaration of the main method, etc.)
e) don't teach bad techniques to those learning java for the first time. (for example when you look for the word "yes" as an answer, you check for all cases of the word when you could've simply used a toLower method and just compared to the word "yes" once rather than three times. by the way, your logic on that part would not have worked.)
f) simply telling them to download a the sdk and an ide is not enough. explain what each does, go through the steps of adding the java bin folder to the path if it not done so... don't even force them to use an ide, explain that any text editors serves just fine...
so simply put, don't try to educate others on subjects which you are not familiar with yourself.
Code:
import java.awt.*; // this is an import statement, it imports a java package, in this
// case java.awt into your program, thus making that package's
// objects available, such as java.awt.Frame
public class testClass { // this is a class declaration, the class is public and
// its name is testClass, thus you must have a file named
// testClass.java
testClass() { // this is called the constructor, it executes the code within it
// whenever a new a new instance of the testClass class is created
int x = 5; // this declares the variable x as an integer (whole real
// number) and assigns the value 5 to it.
x = x + 1; // this takes the value of x, adds 1 to it, and sets the
// new value to x, other common operators include -,*,/,
// and etc.
System.out.println("the value of x is: " + x);
// the above statement outputs "the value of x is 6" to
// the screen. anything in quotes is taken directly as text
// and is outputed as written in the quotes. the + appends
// the value of x to the end of the text
}
public static void main() {
// this is the main method, when interpreted, this is
// where java will begin executing code
new testClass(); // this creates a new instance of the testClass
// class and executes the code within the constructor
}
}
this is a rough outline of how detailed you should go with your explanations, don't assume the reader knows how everything works, explain it to them, no detail is too small to skip when teaching someone something for the first time.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|