Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Question:
- What is the order of the output statements below when the "main" method gets run?
- Answer [DON'T CHEAT ;)]:
- http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=303&p_certName=SQ1Z0_803
- */
- public class Sequence {
- Sequence() {
- System.out.print("c ");
- }
- {
- System.out.print("y ");
- }
- public static void main(String[] args) {
- new Sequence().go();
- }
- void go() {
- System.out.print("g ");
- }
- static {
- System.out.print("x ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment