Java, I have several true or false questions A. The main() method is automatically executed when a java application is ran B. statement must end with a period C. An escape sequence must be used to display a double quotation mark D. There is no difference between the println and print method E. with an enumerated type, the programmer cant define the possible value of the type
How far did you get with them? What confused you about them?
public class Answer { public enum Question {A, B, C, D, E} private Question q; Answer(Question q) { this.q = q; } public static void main(String[] args) { Answer a = new Answer(Question.C); // here you specifies your question switch (a.q) { case A: System.out.println("I am running (true)"); break; case B: System.out.println("What is at the end of this statment? .? (false)"); break; case C: System.out.println("Not only for \" but e.g. \n\b also \" (false)"); break; case D: System.out.print("there is different"); System.out.println("between println and print"); System.out.println("println"); System.out.print("and print"); System.out.print("\n\n\n (false)"); break; case E: System.out.println("at first look yes, but enum is a special class, and in its body you can specify types (false)"); System.out.println("and this is a bad example"); break; } } } Try to play with this and if you have questions ask.
@zeeporo you complied quite the explanation there.
Thank you so much guys.
Join our real-time social learning platform and learn together with your friends!