Results 1 to 3 of 3
Thread: Problem with visibility modifier
- 07-30-2013, 06:26 PM #1
Member
- Join Date
- May 2013
- Posts
- 19
- Rep Power
- 0
Problem with visibility modifier
Java Code:private static int validateMark(){ private boolean status = false; private int mark = 0; while(status == false) { try{ mark = scanner.nextInt(); status = true; } catch(java.util.InputMismatchException e){ status = false; System.out.println("-- Please Enter Integer Value --"); scanner.nextLine();// Consume token } } return mark; }
G:\Java\JavaPractical\P8\P8Q1\testDriver.java:79: error: illegal start of expression
private boolean status = false;
^
G:\Java\JavaPractical\P8\P8Q1\testDriver.java:80: error: illegal start of expression
private int mark = 0;
^
2 errors
- 07-30-2013, 06:31 PM #2
Re: Problem with visibility modifier
Assuming this is a function inside a valid class, the lines the compiler is complaining about don't make sense for the following reason:
What does it mean for a variable defined inside a method to be private? The variable will go out of scope as soon as the method return anyway.How to Ask Questions the Smart Way
Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
Static Void Games forum - Come say hello!
- 07-30-2013, 06:36 PM #3
Member
- Join Date
- May 2013
- Posts
- 19
- Rep Power
- 0
Similar Threads
-
Set visibility of parent Container
By mwr1976 in forum AWT / SwingReplies: 2Last Post: 04-14-2012, 03:37 AM -
Java, Reset Visibility Of An Object
By Alerhau in forum New To JavaReplies: 1Last Post: 08-11-2011, 12:53 AM -
Help! set dinamically visibility of panels
By unkus_nob in forum JavaFXReplies: 5Last Post: 06-21-2011, 10:06 PM -
Java Visibility
By efozdel in forum New To JavaReplies: 8Last Post: 07-07-2010, 04:36 AM -
Newbie help on visibility and static final
By tornado in forum New To JavaReplies: 3Last Post: 11-28-2008, 02:32 AM
Bookmarks