Will the following code compile(byte type value claculation)? : Questions « Type Casting « SCJP






public class MainClass {
  public static void main(String[] argv) {
    byte b = 1;
    byte b1 = 2;
    b = b * b1;
  }
}
    

A.      Yes
B.      No








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