End of Lesson ExercisesΒΆ
Answer the following questions on a piece of paper to fully understand the lesson content. Some questions might require you to research further.
Convert this code on one line to the proper format of multiple lines.
1
public class OneLiner{public static void main(String[] args){System.out.println("This is a one liner!");}}
Convert this K&R indentation to Allman indentation.
1 2 3 4 5 6 7
public class Indentation { public static void main(String[] args) { System.out.println("Some"); System.out.println("Random"); System.out.println("Text"); } }
Find the names for 5 other indentation styles.
Space out the expressions here properly.
1
System.out.println(10+10+2*4/6%50*22-100);
Comment out line 5 and 7 of the code below.
1 2 3 4 5 6 7 8 9 10
public class Indentation { public static void main(String[] args) { System.out.println("Thats"); System.out.println("Random"); System.out.println("Stuff"); System.out.println(":)"); } }
Find and give a description of 8 tags from Javadoc comments.
Describe all three types of errors.
Find more examples of errors online and how the errors were fixed.