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, 2022 in Java by narikkadan
• 63,600 points
5,524 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
1,851 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, 2022 in Java by Rahul
• 9,680 points
2,061 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
24,964 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,840 points
1,792 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,840 points
13,049 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,140 points
626 views
0 votes
0 answers

Why doesn't importing java.util.* include Arrays and Lists?

I am using java on debian 5 java ...READ MORE

Nov 16, 2022 in Java by Ashwini
• 5,430 points
734 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
4,018 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,140 points
1,433 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP