Home » Java Aptitude Que. & Ans.

Java Basic Input & Output Aptitude Questions and Answers. Page 2

List of Java Basic I/O Aptitude Questions

6) What will be the output of following program?
public class prg {
    public static void main(String[] args) {
        char a=0x41;	//Unicode of 'A'
        char b=0x42;	//Unicode of 'B'
        
        System.out.print(a+"" + b+"");
        System.out.print("-");
        System.out.print(a+b);       
    }
}
  1. AB-AB
  2. AB-131
  3. AB-ERROR
  4. A B -131

7) What should be the name of java program file containing this program?
public class MyPrg
{
    public static void main(String args[])
    {
        System.out.print("IncludeHelp");
 
    }
}
  1. MyPrg.class
  2. MyPrg.java
  3. MyPrg
  4. Any file name with java extension



10) What will be the output of following program?
class Prg
{
    public static void main(String args[])
    {
        const int a=10;
        System.out.println(a);
 
    }
}
  1. 10
  2. a
  3. Unprintable Character
  4. Error



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.