So I\'m writing Java and I got the error message: Exception in thread ?main? jav
ID: 652219 • Letter: S
Question
So I'm writing Java and I got the error message:
Exception in thread ?main? java.lang.NoSuchMethodError: main
So I put it in but I can't figure out how to put my test data in with it.
Any help is appreciated
Herre is my code:
Here is my test app code:
public class Rational { public static void main(String args[]) { // instance data members private int num; private int denom; // constructor public Rational(int numerator, int denominator) { // initialize num and denom with the parameters int g = 3cd(numerator, denominator); Num=numerator/g; denom - denominator/g; if (denomExplanation / Answer
You have to put the main method in the test file(RatTestApp.java), instead of Rational.java(remove it from Rational.java)
Look in your file RatTestApp.java
There is a method called test(public void test(String args[])). Rename that method to the main method(like this: public static void main(String args[])). Don't forget the static keyword.
It should work.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.