Hello gang:
I am a rookie in Java.
I am trying to run a program, however it gives me the following error:
C:\j2sdk1.4.0\bin>javac Exercise3_16.java
C:\j2sdk1.4.0\bin>java Exercise3_16
Exception in thread "main" java.lang.NoSuchMethodError: main
The program producing this error is the following:
//The Graphics class contains a drawOval method that takes the same
//four arguments as method drawRect. However, the arguments for
//method drawOval specify the "bounding box" for the oval. The sides
//of the bounding box are the boundaries of the oval. Write a Java
//applet that draws an oval and a rectangle with the same four arguments.
//Your will see that the oval touches the rectangle at the center
//of each side.
import java.awt.Graphics;
import javax.swing.*;
public class Exercise3_16 extends JApplet {
int number1;
int number2;
int number3;
int number4;
public void init()
{
String firstNumber;
String secondNumber;
String thirdNumber;
String fourthNumber;
firstNumber = JOptionPane.showInputDialog(
"Enter number1 " );
secondNumber = JOptionPane.showInputDialog(
"Enter number2" );
thirdNumber = JOptionPane.showInputDialog(
"Enter number3 " );
fourthNumber = JOptionPane.showInputDialog(
"Enter number4 " );
number1 = Integer.parseInt( firstNumber );
number2 = Integer.parseInt( secondNumber );
number3 = Integer.parseInt( thirdNumber );
number4 = Integer.parseInt( fourthNumber );
}
public void paint(Graphics g)
{
super.paint( g );
g.drawRect(number1, number2, number3, number4);
g.drawOval(number1, number2, number3, number4);
}
}
//Please point me out as to what the problem and the solution might be.
//Thanks, the Rookie.
I am a rookie in Java.
I am trying to run a program, however it gives me the following error:
C:\j2sdk1.4.0\bin>javac Exercise3_16.java
C:\j2sdk1.4.0\bin>java Exercise3_16
Exception in thread "main" java.lang.NoSuchMethodError: main
The program producing this error is the following:
//The Graphics class contains a drawOval method that takes the same
//four arguments as method drawRect. However, the arguments for
//method drawOval specify the "bounding box" for the oval. The sides
//of the bounding box are the boundaries of the oval. Write a Java
//applet that draws an oval and a rectangle with the same four arguments.
//Your will see that the oval touches the rectangle at the center
//of each side.
import java.awt.Graphics;
import javax.swing.*;
public class Exercise3_16 extends JApplet {
int number1;
int number2;
int number3;
int number4;
public void init()
{
String firstNumber;
String secondNumber;
String thirdNumber;
String fourthNumber;
firstNumber = JOptionPane.showInputDialog(
"Enter number1 " );
secondNumber = JOptionPane.showInputDialog(
"Enter number2" );
thirdNumber = JOptionPane.showInputDialog(
"Enter number3 " );
fourthNumber = JOptionPane.showInputDialog(
"Enter number4 " );
number1 = Integer.parseInt( firstNumber );
number2 = Integer.parseInt( secondNumber );
number3 = Integer.parseInt( thirdNumber );
number4 = Integer.parseInt( fourthNumber );
}
public void paint(Graphics g)
{
super.paint( g );
g.drawRect(number1, number2, number3, number4);
g.drawOval(number1, number2, number3, number4);
}
}
//Please point me out as to what the problem and the solution might be.
//Thanks, the Rookie.
Last edited: