Welcome! Log In Create A New Profile



Posted by maputra 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
March 26, 2010 01:11PM
How can i make my Exception to be recognised ny the program i can see the catch but when i want the user to enter a string the inturn enters a number how do i do that?
Re: Exceptions
March 30, 2010 10:38AM
look at this example code

Language: Java
import java.util.InputMismatchException; import java.util.Scanner;   public class ExceptionExample{   public static void main(String[] args) { System.out.println("Please enter a number"); Scanner sc = new Scanner(System.in); int num; try{ num = sc.nextInt(); } catch(InputMismatchException n){ System.out.println("Exception: Number required"); }   finally{ System.out.println("Finally Block is always Executed"); }   } }
Re: Exceptions
April 01, 2010 02:24PM
thanks man i can see now.
Sorry, only registered users may post in this forum.

Click here to login