Author |
Message |
Kyle
|
Posted: Mon Jun 27, 2005 11:32 am Post subject: Very First Thing To learn? |
|
|
Ok all of you might think im a big dumb @$$ for posting this but i downloaded NerBeans 4.1 last night. and i just finished grad 10 computer science (Turing and i think i did ok in that class) Now im going to be tacking Java in grade 11 and i have no idea how touse netbeans or how to program in Java. Im asking how do you out put text to the screen i was given a line cant remeber but i tryed it and it did not work. is Netbeans for beginers? and how do you output text to the screen?
Sory if my lack of Java programing disterbs you guys.
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Aziz
|
Posted: Mon Jun 27, 2005 12:43 pm Post subject: (No subject) |
|
|
This is what you need. Start from the beginning. Java isn't like Turing. Turing you can simply say "put "Hello World!"", but Java is strictly object-orientated, everything is done in classes, and you need to set up your enviroment. Read this, and ask your teaching for a textbook:
http://java.sun.com/docs/books/tutorial/
|
|
|
|
|
|
Kyle
|
Posted: Mon Jun 27, 2005 1:38 pm Post subject: (No subject) |
|
|
hmm thanks alot pal that rely helps.
|
|
|
|
|
|
Aziz
|
Posted: Mon Jun 27, 2005 2:44 pm Post subject: (No subject) |
|
|
Not a problem. Good look diving into Java
|
|
|
|
|
|
Kyle
|
Posted: Mon Jun 27, 2005 9:19 pm Post subject: (No subject) |
|
|
ok at that site you sent me it gives me an example of how to output "Hello World" on to the screen.
code: | /**
* The HelloWorldApp class implements an application that
* simply displays "Hello World!" to the standard output.
*/
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); //Display the string.
}
} |
When i try to run this example it says <No main classes found> or < class "filename" does not have a main method. this might be easy for you guys but this is my first day. So what does this mean....... Im using Netbeans 4.1.
|
|
|
|
|
|
Naveg
|
Posted: Mon Jun 27, 2005 10:01 pm Post subject: (No subject) |
|
|
the square brackets go after the args
code: | public static void main (String args[]) |
|
|
|
|
|
|
wtd
|
Posted: Mon Jun 27, 2005 10:28 pm Post subject: (No subject) |
|
|
Vladimir wrote: the square brackets go after the args
code: | public static void main (String args[]) |
No. They don't.
Replace "class HelloWorldApp" with "public class HelloWorldApp".
|
|
|
|
|
|
Naveg
|
Posted: Mon Jun 27, 2005 11:09 pm Post subject: (No subject) |
|
|
That too
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Kyle
|
Posted: Tue Jun 28, 2005 8:18 pm Post subject: (No subject) |
|
|
hmm... nope. the code is
code: | public class HelloWorldApp {
public static void main(String args []) {
System.out.println("Hello World!"); //Display the string.
}
} |
still i get <No main classes found> or < class "filename" does not have a main method ... hmm i think i did what you gys said. . .
|
|
|
|
|
|
rizzix
|
Posted: Tue Jun 28, 2005 8:42 pm Post subject: (No subject) |
|
|
post ur file...
|
|
|
|
|
|
Kyle
|
|
|
|
|
rizzix
|
Posted: Tue Jun 28, 2005 11:13 pm Post subject: (No subject) |
|
|
ehm... some project settings in netbeans??... try changing ur filename to HelloWorldApp.java or the class name to Main.
it is a standard convention in java to name the .java file after the class name (or visa versa).. please do follow the conventions.
|
|
|
|
|
|
Kyle
|
Posted: Wed Jun 29, 2005 8:50 pm Post subject: (No subject) |
|
|
hmm i tryed naming the class to Main but still nothing. I dunno what im going to do... im taking Java in school next year ... I dought that the schools use netbeans... Is there an easer program for beginers that no nothing at all about Java. I heard that [ Ready to Program is very easy] but i dunno if its free, Can you send me a link to an easy program which i can learn jave easly. Please
|
|
|
|
|
|
wtd
|
Posted: Wed Jun 29, 2005 9:16 pm Post subject: (No subject) |
|
|
Ifyou want something easier to use for this level of programming, simply use a text editor and the command-line tools Sun provides.
|
|
|
|
|
|
Kyle
|
Posted: Wed Jun 29, 2005 9:26 pm Post subject: (No subject) |
|
|
ok thanks i will read up on that. THANKS
|
|
|
|
|
|
|