Guess the output of this java program.
class CoolProg
{
static void main()
{
System.out.println(Math.random());
System.out.println("over"+2+3);
System.out.println(2+3+"over"+0);
System.out.println(2+3+"over");
System.out.println(2+3+'A'+-1);
System.out.println('a'+"bhas");
System.out.println('A'+ 2);
System.out.println('A'+ 2);
int b=1;
int c=-b;
System.out.println(-b);
System.out.println(c);
String s="abhas";
System.out.println(s.substring(3,5));
System.out.println(s.substring(0,3));
System.out.println(s.substring(4));
System.out.println(s.substring(2));
}
}
/* * answer
0.6834987231679766 (random no less than 1)
over23
5over0
5over
69
abhas
67
67
-1
-1
as
abh
s
has
*/
Saturday, January 26, 2008
ICSE Computer JAVA question
Posted by Blogger 2.o at 7:13 AM 0 comments
Labels: computer icse, computer program, icse, ICSE 2008 Exam, JAVA, JAVA program, JAVA related questions, model test paper, Questions
Subscribe to:
Posts (Atom)