Home » Java Aptitude Que. & Ans.

Java Basic Input & Output Aptitude Questions and Answers

This section contains Aptitude Questions and Answers on Java Basic Input Output, Declaration etc.

List of Java Basic I/O Aptitude Questions

1) What will be the output of following program ?
public class Prg {
	public static void main(String args[]){
		System.out.print('A' + 'B');
	}
}
  1. AB
  2. 195
  3. 131
  4. Error

2) What will be the output of following program ?
public class Prg {
	public static void main(String args[]){
		System.out.print("A" + "B" + 'A');
	}
}
  1. ABA
  2. AB65
  3. Error
  4. AB

3) What will be the output of following program?
public class Prg {
	public static void main(String args[]){
		System.out.print(20+ 1.34f + "A" + "B");
	}
}
  1. 201.34AB
  2. 201.34fAB
  3. 21.34AB
  4. Error

4) What will be the output of following program?
public class Prg {
    public static void main(String[] args) {
        char [] str={'i','n','c','l','u','d','e','h','e','l','p'};
        System.out.println(str.toString());
    }
}
  1. includehelp
  2. Error
  3. [C@19e0bfd (Memory Address)
  4. NULL

5) What will be the output of following program?
public class prg {
    public static void main(String[] args) {
        System.out.print("Hello");
        System.out.println("Guys!");
    }
}
  1. HelloGuys!
  2. Hello Guys!
  3. Hello
     Guys!
  4. Compile with a Warning



Comments and Discussions!

Load comments ↻





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