Help on interface tutorial

just started trying to learn java today, so i am a total newbie. anyways, this is what my current code looks like:

/*

* Main.java

*

* Created on July 2, 2007, 1:13 AM

*

* To change this template, choose Tools | Template Manager

* and open the template in the editor.

*/

package javaapplication20;

/**

*

* @author spacemonkeys

*/

publicclass Main{

interface Bicycle{

void changeCadence(int newValue);

void changeGear(int newValue);

void speedUp(int increment);

void applyBrakes(int decrement);

}

/** Creates a new instance of Main */

public Main(){

}

/**

* @param args the command line arguments

*/

publicstaticvoid main(String[] args){

class ACMEBicycleimplements Bicycle{

// remainder of this class implemented as before

publicvoid changeCadence(int newValue){

}

publicvoid changeGear(int newValue){

}

publicvoid speedUp(int increment){

}

publicvoid applyBrakes(int decrement){

}

}

}

}

when i click run, nothing shows up and it just says init:

deps-jar:

compile:

run:

BUILD SUCCESSFUL (total time: 1 second)

am i doing something wrong or what is this supposed to do? heres the link to the tutorial page (i wish they would include a file with the correct .java file ><) http://java.sun.com/docs/books/tutorial/java/concepts/interface.html

[3168 byte] By [spacemonkeys9999a] at [2007-11-27 9:23:04]
# 1
you did nothing wrong. :) It's supposed to behave that way - It's just a code to illustrate the Interface construct of Java.
lem@phila at 2007-7-12 22:17:56 > top of Java-index,Java Essentials,New To Java...
# 2

You have a nested or inner interface where it is totally located w/in another class. please don't do that, at least not at this stage in your game. put your interface in its own file. also you cannot declare a class w/in a method.

You need to study the basics first. Move a bit back in the tutorial pathways to the beginning and review how to construct a class, method, ect...

good luck.

petes1234a at 2007-7-12 22:17:56 > top of Java-index,Java Essentials,New To Java...
# 3

> you did nothing wrong. :) It's supposed to behave

> that way - It's just a code to

> illustrate the Interface construct of Java.

what? you think that it's ok for him to define his ACMEBicycle class within the main method? How can you honestly say he did nothing wrong?

Message was edited by:

petes1234

petes1234a at 2007-7-12 22:17:56 > top of Java-index,Java Essentials,New To Java...
# 4
sorry. spacemonkey, petes1234 is right. That is wrong programmingconstruction. Your code will compile, and run fine - but that is not the rightway to implement it.
lem@phila at 2007-7-12 22:17:56 > top of Java-index,Java Essentials,New To Java...
# 5
no offense taken :) could someone explain the correct way to code this then? the tutorial seems very vague :( is there a better tutorial for learning java or should i stick with this one? thanks for the fast responses!
spacemonkeys9999a at 2007-7-12 22:17:56 > top of Java-index,Java Essentials,New To Java...
# 6

you need to first learn more primative basics before advancing here. You were making some serious mistakes in your code that had nothing to do with Interfaces. So that you don't perpetuate these, I'd start the java trail over from the beginning with a little more attention to the source code of the samples.

Good luck!

petes1234a at 2007-7-12 22:17:56 > top of Java-index,Java Essentials,New To Java...
# 7

I really believe you need to read whole books on the topic of java rather than get information off the internet. May I suggest the book 'Thinking in Java'. You can order it on-line for less cost than you can in a book store. There's other books that you need to read too in order to build a web site ( JSP, servlets, xhtml, javascript, etc, etc), but I believe 'Thinking in java' is a good place to start.

George123a at 2007-7-12 22:17:56 > top of Java-index,Java Essentials,New To Java...
# 8
That code hurts my head.
RedUnderTheBeda at 2007-7-12 22:17:56 > top of Java-index,Java Essentials,New To Java...
# 9

> I really believe you need to read whole books on the

> topic of java rather than get information off the

> internet. May I suggest the book 'Thinking in Java'.

> You can order it on-line for less cost than you can

> in a book store.

May I also add, that there's also a free version of the earlier edition of that book,

which is downloadable from the author's site: http://www.mindviewinc.com/

And I also recommend a recent revolutionary (in terms of its approach) one:

Head First in Java which is published by O'reilly.

lem@phila at 2007-7-12 22:17:56 > top of Java-index,Java Essentials,New To Java...