Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please correct the lines of code based on the compiler error messages. public class DisplayMesg.java { public static void main(String[] args) { System. out.println(Welcome to

please correct the lines of code based on the compiler error messages.
image text in transcribed
image text in transcribed
image text in transcribed
public class DisplayMesg.java \{ public static void main(String[] args) \{ System. out.println("Welcome to Java"); System.out.println("Welcome to Computer Science"); System.out.println("Programming is fun"); Exercise01 01.java: 3: error: ' { ' expected public class DisplayMesg.java \{ 1 erron 1. 3 public class DisplayMesg.java \{ public static void main(String[] args) f System.out.println("Welcome to Java"); System.out.print1n("Welcome to Computer Science"); System, out.printin("Programming is fun"); public class Main \{ public static vold main(String[] args) \{ double result1 9.54.52.53; double result 2 - 45.53.5; System.out.printin( Result 1: + result1); System.out, println("Result 2:"+result2 ); Exercisee1 05. java:3: error: class Main is public, should be dectared in a flie named Main.java public class Main i 1 ernor 21 7ublic class MaLn ( public statle vold main(String[] args) f doubte resuitt =9.54.52.53; double resultz =45.5=3.5; Systemiout. println( Result i: - + result 1 ) System, out.print ln ("Result 2:+ +result 2 ); public class Main \& public static void main(String[] args) \{ double result 1=9.54.52.53; double result =45.53.5; System.out. println("Result 1:"+ result 1 ); System.out.print ln("Result 2:+ result 2 ); \} COMPILER ERROI MESSAGES Exercise01_05. Java:3: erron: class Main is public, should be declared in a file nared Main. Java public class Main \{ 1 error

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions