Register Login
Internet / AI Technology University (ITU/AITU)
Created by info@itofthefuture.com
Welcome Anonimous.User to this quiz related to Java Security.

Read the question and choose the best answer. Time is limited to 40 seconds!

Important! Do not forget to rank the quality of the question (from bad to excellent).
An initiator of the quiz will get royalty score for QnAs created by her/him and can win the Top Creativity Prize.
Question:
Let us suppose that we have the following CreditCard and TestCreditCard classes.
public class CreditCard {
  public String acctNo = "0001 0002 0003 0004";
}

public class TestCreditCard {
  public static void main(String args[]) {
    CreditCard cc = new CreditCard( ); // (1)
    System.out.println("Your account number is " + cc.acctNo); // (2)
  }
}
Now say that we realize the account number should really have been private, so we go back and change the definition of acctNo to be private and recompile only the CreditCard class:
public class CreditCard {
  private String acctNo = "0001 0002 0003 0004";
}
What result will produce execution of TestCreditCard?

It throws IllegalAccessException at line (2).



The behavior of JVM is not specified for such cases, it depends on implementation.



It prints account number in spite of private specifier.



It throws ClassNotFoundException at line (1).



JVM will refuse to run TestCreditCard as it uses CreditCard and
it should be recompiled to use newer version of CreditCard.



It throws SecurityException at line (2).



Rank the Quality of the Question from "-10" (bad) or "0" (not clear) to 10 (correct) or even 20 (very good!)
-10 (bad/wrong) 0 (not clear) 10 (correct) 20 (very good!)
Your summary report will be available to you and your instructor. Thank you for your work!!!