Exercise 3-3 (ATypeName)

Chapter_3     Exercise_3-2 Exercises_3-4,5







Exercise 3-3     TIJ, p. 61


Exercise 3-3: (1) Find the code fragments involving ATypeName and turn them into a program that compiles and runs.




ATypeName.java     TIJ, p. 46


Note:  First variant compiles, but does not run:


public class ATypeName {}
/*
javac ATypeName.java
java ATypeName // runtime error:
Error: Main method not found in class ATypeName, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application
*/







Note:  Second variant is fine:


public class ATypeName
{
public static void main(String[] args)
{
ATypeName a = new ATypeName();
}
}
/*
javac ATypeName.java
java ATypeName
*/









Chapter_3     Exercise_3-2 BACK_TO_TOP Exercises_3-4,5



Comments

Popular posts from this blog

Contents