Variable Scope - PowerPoint PPT Presentation

About This Presentation
Title:

Variable Scope

Description:

BufferedReader br = new BufferedReader(isr); int iNum = 0; String sUserInput ... location: class VarScope. System.out.println('and you typed ' sUserInput); 1 error ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 5
Provided by: blanc9
Learn more at: http://www2.hawaii.edu
Category:
Tags: class | scope | variable

less

Transcript and Presenter's Notes

Title: Variable Scope


1
Variable Scope
  • Brackets, brackets. brackets

2
Variable Scope
/ HelloWorld --- program that prints
something to the screen. _at_author Blanca Polo
/ public class HelloWorld public static
void main (String arg ) String s
Hello World!!! System.out.println( s )

3
VariableScope
public class ParseI public static void main
(String arg )throws Exception
InputStreamReader isr new InputStreamReader(Syst
em.in) BufferedReader br new
BufferedReader(isr) int iNum 0
String sUserInput ""
System.out.println("Enter a number please ")
sUserInput br.readLine( )
System.out.println("You typed " sUserInput)
//risky code try iNum
Integer.parseInt(sUserInput)
System.out.println("Thanks for the number!!! ")
catch(NumberFormatException
nfe) System.out.println("I asked
for a number, dummy!!")
System.out.println("- - - - the end - - - -
") //main // class
4
VariableScope
public class ParseI public static void main
(String arg )throws Exception
InputStreamReader isr new InputStreamReader(Syst
em.in) BufferedReader br new
BufferedReader(isr) //risky code try
String sUserInput ""
System.out.println("Enter a number please ")
sUserInput br.readLine( )
System.out.println("You typed "
sUserInput) int iNum 0
iNum Integer.parseInt(sUserInput)
System.out.println("Thanks for the
number!!! ")
catch(NumberFormatException nfe)
System.out.println("I asked for a number,
dummy!!") System.out.println(and
you typed sUserInput)
System.out.println("- - - - the end - - - -
") //main // class
Write a Comment
User Comments (0)
About PowerShow.com