Salve a tutti, sono nuovo del forum e sono nuovo anche in materia di programmazione.
Parto subito con una domanda a bruciapelo riguardante la programmazione in Java.
Prendendo spunto da un libro che sto studiando (o meglio, CERCANDO di studiare) ho scritto questo codice:

codice:
public class Bottles of beer {
	public static void main (String[] args) {
		int beerNum = 99;
		String word = "bottles";
		
	while (beernum > 0) {
	
		if (beerNum == 1) {
			word = "bottle"; // singular, as in ONE bottle.
			
		}
		
		System.out.println(beerNum + " " + word + "of beer on the wall");
		System.out.println(beerNum + " " + word + "of beer.");
		System.out.println("Take one down.");
		System.out.println("Pass it around.");
		beerNum = beerNum -1;
		
		
		if (beerNum > 0) {
			System.out.println(beerNum + " " + word + "of beer on the wall");
		} else {
			System.out.println("No more bottles of beer on the wall");
		} // end else
	} // end while loop
} // end main method
} // end class
Io uso Mac per cui ho scritto questo codice con Text Wrangler, l'ho salvato (.java) e poi da terminale ho provato a compilare il file usando il comando apposito:

codice:
javac Bottles of beer.java
javac: file not found: beer.java
Usage: javac <options> <source files>
use -help for a list of possible options
ho anche provato:

codice:
java -cp . Bottles of beer
Exception in thread "main" java.lang.NoClassDefFoundError: Bottles
Caused by: java.lang.ClassNotFoundException: Bottles
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Come avrete capito sono piuttosto ignorante a riguardo, se qualcuno potesse spiegarmi/aiutarmi gliene sarei molto grato. Imparare a programmare mi piacerebbe molto e sono sicuro che oltrepassati i gradini iniziali poi andrà tutto un po' meglio.

Luca.