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]

You have a file Ghost.java and you have a driver class named…

You have a file Ghost.java and you have a driver class named Driver.java. Fill in the correct visibility modifiers so that the comments in the main method are upheld.  public class Driver {     public static void main(String[] args) {         Ghost t = new Ghost();         // each of the lines below is run independently        System.out.println(t.age);    // compiles and runs        System.out.println(t.getPower()); // compile error        System.out.println(t.power); // compiles and runs     } }  —— in a separate file in a different package/directory ———  public class Ghost {        1   int age;       2   int power;       3   int getPower() {        return power;     }     /** no-argument constructor implemented **/ }    1  :[vis1]   2  :[vis2]   3  :[vis3]

You have a file State.java and you have a driver class named…

You have a file State.java and you have a driver class named Driver.java. Fill in the correct visibility modifiers so that the comments in the main method are upheld.  public class Driver {     public static void main(String[] args) {         State t = new State();         // each of the lines below is run independently        System.out.println(t.getAveragePopulation()); // compile error System.out.println(t.averagePopulation); // compiles and run System.out.println(t.numCounties);    // compiles and runs     } }  —— in a separate file in a different package/directory ———  public class State {        1   int numCounties;       2   double averagePopulation;       3   double getAveragePopulation() {        return averagePopulation;     }     /** no-argument constructor implemented **/ }    1  :[vis1]   2  :[vis2]   3  :[vis3]