The Artima Developer Community
Sponsored Link

Java Buzz Forum
Programing Inrerview Questions on try catch

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
instanceof java

Posts: 576
Nickname: instanceof
Registered: Jan, 2015

instanceof java is a java related one.
Programing Inrerview Questions on try catch Posted: Jan 13, 2015 3:48 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by instanceof java.
Original Post: Programing Inrerview Questions on try catch
Feed Title: Instance Of Java
Feed URL: http://feeds.feedburner.com/blogspot/TXghwE
Feed Description: Instance of Java. A place where you can learn java in simple way each and every topic covered with many points and sample programs.
Latest Java Buzz Posts
Latest Java Buzz Posts by instanceof java
Latest Posts From Instance Of Java

Advertisement

1. what is the output of following program:

  1. package com.instanceofjavaforus;
  2.  
  3. public class Demo{
  4.  
  5.  public static void main(String[] args) {
  6.  
  7.      try{
  8.  
  9.     System.out.println("instance of java");    
  10.  
  11.     }
  12.  
  13. }
  14. }


Click for Output



2. what is the output of following program:

  1. package com.instanceofjavaforus;
  2.  
  3. public class Demo{
  4.  
  5.  public static void main(String[] args) {
  6.  
  7.      try{
  8.  
  9.     System.out.println("try block");   
  10.  
  11.     }
  12.    finally{
  13.  
  14.     System.out.println("finally block");    
  15.  
  16.   }
  17.  
  18. }
  19. }


Click for Output



3. what is the output of following program:

  1. package com.instanceofjavaforus;
  2.  
  3. public class StringDemo{
  4.  
  5.  public static void main(String[] args) {
  6.  
  7.             
  8.         try {
  9.  
  10.             int a = 0;
  11.             int b = 10;
  12.             int c = b / a;
  13.  
  14.             System.out.print("try block");
  15.  
  16.         }
  17.         catch(Exception e) {
  18.  
  19.               System.out.print("catch block");
  20.  
  21.         }    
  22.  
  23. }
  24. }


Click for Output

Read: Programing Inrerview Questions on try catch

Topic: JSON Schema Previous Topic   Next Topic Topic: Make the most of Pmd, Findbugs and CheckStyle result.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use