java - else without if when trying to create register system -



java - else without if when trying to create register system -

when trying run next code, produces else without if error.

public void registerstudent(int register) { { if (register >= 100) system.out.println("the maximum number of students allowed on course of study 100."); } else { register = register + 1; system.out.println("you have been registered on course."); } }

you have { @ origin of method, , forgot { after if condition.

change

{ if (register >= 100) system.out.println("the maximum number of students allowed on course of study 100."); }

to

if (register >= 100) { system.out.println("the maximum number of students allowed on course of study 100."); }

your current if status enclosed in own block, , separated else clause.

java if-statement

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -