What is the output(int,string mehtod overloading)? : Questions « Type Casting « SCJP






public class MainClass {
  void myMethod(int i) {
    System.out.println("int version");
  }

  void myMethod(String s) {
    System.out.println("String version");
  }

  public static void main(String args[]) {
    MainClass my = new MainClass();
    char ch = 'p';
    my.myMethod(ch);
  }
}








4.5.Questions
4.5.1.Only primitives are converted automatically (True/False)
4.5.2.Answer: conversion and primitives
4.5.3.Casting of numeric types may require a runtime check (True/False)
4.5.4.Answer: casting and runtime checking
4.5.5.Is the following code compilable(short and byte type assignment)?
4.5.6.Answer: short and byte type assignment
4.5.7.Is the following code compilable(assignment between byte and short)?
4.5.8.Answer: assignment between byte and short
4.5.9.Will the following code compile(byte type value claculation)?
4.5.10.Answer: byte type value claculation
4.5.11.What is the output(int,string mehtod overloading)?
4.5.12.Answer: int,string mehtod overloading