Exception in thread main java lang Error Unresolved compilation problems

0 votes

I am facing issues importing classes and setting variables. I am testing out a program that just simply outputs what your input was and puts a time stamp.

Here is my code:

class Test {
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        Message messageObject = new Message ();
        Time timeObject = new Time ();

        System.out.println("Enter your message here: ");
        String message = input.nextLine();

        messageObject.simpleMessage(message);
        timeObject.getTime();
    }

    void simpleMessage(String message) {
        System.out.println(message + time);
    }
}

This is the error that occurred :

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
Message cannot be resolved to a type
Message cannot be resolved to a type
The constructor Time() is undefined

at Test.main(Test.java:8)

Can someone help me with this?

May 7 in Java by narikkadan
• 7,860 points
105 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Java

0 votes
0 answers

Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/HasAuthentication

Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/HasAuthentication at java.base/java.lang.ClassLoader.defineClass1(Native ...READ MORE

Oct 22, 2021 in Java by anonymous
• 120 points
507 views
0 votes
1 answer

Exception in thread main java.util.InputMismatchException error

Problem int name; //Name should be of type ...READ MORE

answered Feb 18 in Java by Rahul
• 8,980 points
222 views
0 votes
2 answers
0 votes
1 answer

How can you catch an exception thrown by another thread in Java?

This can be done using Thread.UncaughtExceptionHandler. Here’s a simple ...READ MORE

answered Dec 3, 2018 in Java by Frankie
• 9,830 points
17,986 views
0 votes
1 answer

Error:“java.lang.OutOfMemoryError: PermGen space” in Maven build

Hello @kartik, When you increased MAVEN_OPTS, you increase the MaxPermSize, ...READ MORE

answered Jun 3, 2020 in Java by Niroj
• 82,680 points
633 views
0 votes
1 answer

Error:java.lang.OutOfMemoryError: Java heap space in Maven

Hello @kartik, Here is the whole config that ...READ MORE

answered Jun 3, 2020 in Java by Niroj
• 82,680 points
5,811 views
0 votes
1 answer

How can one day be added to a date?

One possible solution could be using calendar ...READ MORE

answered Jun 8, 2018 in Java by Daisy
• 8,120 points
184 views
0 votes
3 answers

Can we run selenium tests (Firefox) on WebDriver without a GUI?

Hi ,  Yes, you can use headless browsers ...READ MORE

answered Sep 2, 2020 in Selenium by Sri
• 3,190 points
2,671 views
0 votes
2 answers

How can we take screenshots of tests in Selenium 2 using C#

Hey, try using following code command to ...READ MORE

answered Aug 23, 2019 in Selenium by Abha
• 28,100 points
525 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP