Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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 (denom

Explanation / 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.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote