Hi, can someone please help me with these computer science questions. i am really having a  tough time. thank you.  Which of the following is not an acceptable way of indicating comments in java...

Hi, can someone please help me with these computer science questions. i am really having a  tough time. thank you. 

  1. Which of the following is not an acceptable way of indicating comments in java and briefly explain why?
  1. /** comment */
  2. // comment
  3. /* comment */
  4. // comment comment
  5. /*comment comment*/
  1. Describe what you would do if the interpreter returns the following error     Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp.java.

 

3. Modify this program so that it prints out Goodbye Weekend! instead of Hello World!

/** * The HelloWorldApp class implements an application that * simply displays "Hello World!" to the standard output. */ class HelloWorldApp
{ public static void main(String[] args) { System.out.println("Hello World!"); //Display the string. }

  1. Write a Java Application which when run as a class, produces the following output:

    Java rules
    the waves!

    Include a copy of the code as well as a screen shot when the you run the program.



t-rashmi | Student

1. Although all are some types of comments. /** comment */ is not simple text comment. It is a documentation comment used for combining html codes into java programs.

2. In case of Exception in thread "main" java.lang.NoClassDefFoundError: error, 

you need to add the class or .jar file which contains this class into the java classpath. When you are running a java class from the command line, you need to add the dot (.)

java YourSingleClass -cp .

into the classpath which tells the JVM to search for classes in actual directory.


If you are running a class from a .jar file, you need to add this jar file into the classpath:

java org.somepackage.SomeClass -cp myJarWithSomeClass.jar

 

3. class HelloWorldApp
{ public static void main(String[] args) { System.out.println("Goodbye Weekend!"); //Display the string. }

4.  class javarules
{
public static void main(String args[])
{
System.out.println("Java rules \nthe waves!");
}
}//end of class
Images:
This image has been Flagged as inappropriate Click to unflag
Image (1 of 2)
This image has been Flagged as inappropriate Click to unflag
Image (2 of 2)

Access hundreds of thousands of answers with a free trial.

Start Free Trial
Ask a Question