java - Constructor and method -


for project have question says newgenerationnumber integer. if argument passed parameter less zero, set generationnumber instance variable zero. otherwise assign newgenerationnumber generationnumber instance variable. i'm confused on how start this. code out private int generationnumber

then made if

if (generationnumber >0)    generationnumber = generationnumber 

i'm confused if right , if need make else

generationnumber = newgenerationnumber; if (generationnumber < 0) {     generationnumber = 0; } 

else stays way is


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -