Write 2-3 lines of code to:  Declare a String variable and…

Write 2-3 lines of code to:  Declare a String variable and save your favorite color in it. Print the value of the variable to the console with a newline character after it.  Make sure to select the ‘Preformatted’ style from the dropdown so your code is formatted clearly. DO NOT USE THE TAB KEY WHEN WRITING CODE AS YOU MAY ACCIDENTALLY SUBMIT YOUR EXAM. USE THE SPACE BAR INSTEAD.

Write 2-3 lines of code to:  Declare a String variable and…

Write 2-3 lines of code to:  Declare a String variable and save your name in it. Print the value of the variable to the console with a newline character after it.  Make sure to select the ‘Preformatted’ style from the dropdown so your code is formatted clearly. DO NOT USE THE TAB KEY WHEN WRITING CODE AS YOU MAY ACCIDENTALLY SUBMIT YOUR EXAM. USE THE SPACE BAR INSTEAD.

For the given code below, which lines are valid (will compil…

For the given code below, which lines are valid (will compile and run)? Assume each line is run independently.   public class Foo {     private static int number;     private int jar;     public static double fuzz() {        return 0.0;     }     public int flop() {        return 0;     }     public static void main(String[] args) {         Foo obj = new Foo();        1 obj.fuzz();        2 obj.flop();        3 Foo.fuzz();        4 Foo.flop();                                    5 System.out.println(obj.number);        6 System.out.println(obj.jar);        7 System.out.println(Foo.number);          8 System.out.println(Foo.jar);      } }    1  : [1]   2  : [2]   3  : [3]   4  : [4]   5  : [5]   6  : [6]   7  : [7]   8  : [8]