"Learning gives Creativity,Creativity leads to Thinking, Thinking provides Knowledge, Knowledge makes you Great"
Showing posts with label ocjp. Show all posts
Showing posts with label ocjp. Show all posts
Saturday, 21 September 2013
Saturday, 29 June 2013
OCJP Latest Dumps
Hi All,
Many people on internet are looking for latest and valid Java SE 1.6 dumps.
On this post, I am sharing valid and latest dumps.
Click Here to download.
Please provide feedback after taking exams about the dumps.
Cheers !!
Question - 2
Give the code. What is the result?
class Hotel {
public int bookings;
public void book() {
bookings++;
}
}
public class SuperHotel extends Hotel {
public void book() {
bookings--;
}
public void book(int size) {
book();
super.book();
bookings += size;
}
public static void main(String args[]) {
SuperHotel hotel = new SuperHotel();
hotel.book(2);
System.out.print(hotel.bookings);
}
}
public int bookings;
public void book() {
bookings++;
}
}
public class SuperHotel extends Hotel {
public void book() {
bookings--;
}
public void book(int size) {
book();
super.book();
bookings += size;
}
public static void main(String args[]) {
SuperHotel hotel = new SuperHotel();
hotel.book(2);
System.out.print(hotel.bookings);
}
}
(Correct Answer) |
Wednesday, 26 June 2013
Question - 1
Que: Given a class Repetition:
1. package utils;
2.
3. public class Repetition {
4. public static String twice(String s) { return s + s; }
5. }
and given another class Demo:
1. // insert code here
2.
3. public class Demo {
4. public static void main(String[] args) {
5. System.out.println(twice("pizza"));
6. }
7. }
Which code should be inserted at line 1 of Demo.java to compile and run Demo to print "pizzapizza"?1. package utils;
2.
3. public class Repetition {
4. public static String twice(String s) { return s + s; }
5. }
and given another class Demo:
1. // insert code here
2.
3. public class Demo {
4. public static void main(String[] args) {
5. System.out.println(twice("pizza"));
6. }
7. }
A. import utils.*;
B. static import utils.*;
C. import utils.Repetition.*;
D. static import utils.Repetition.*;
E. import utils.Repetition.twice();
F. import static utils.Repetition.twice;
G. static import utils.Repetition.twice;
Answer: F
Subscribe to:
Posts (Atom)