B
Bruce Sam
/* ******************************* */
class PDomainEnum {
public static final int PDPoint = 0;
public static final int PDLine = 1;
}
class PDomain {
PDomainEnum type;
public void within(type) {
switch(type) {
case PDPoint:
break;
case PDLine:
break;
default:
break;
}
}
}
/* ************************** */
The above is a not a completed program but just to show
something.I want to create an enum PDomainEnum,it has two variable
PDPoint and PDLine.In PDomain,I define an object of PDomainEnum
type.The most important thing that I want to do is use the switch( ) to
select statement.I know switch not allow the non-int type in it.But I
can't find a method to implement the selection statement.Could you give
me some advice?Addtional,I'm using J2SE 1.4.2,and has some reason I
can't not use J2SE1.5.
class PDomainEnum {
public static final int PDPoint = 0;
public static final int PDLine = 1;
}
class PDomain {
PDomainEnum type;
public void within(type) {
switch(type) {
case PDPoint:
break;
case PDLine:
break;
default:
break;
}
}
}
/* ************************** */
The above is a not a completed program but just to show
something.I want to create an enum PDomainEnum,it has two variable
PDPoint and PDLine.In PDomain,I define an object of PDomainEnum
type.The most important thing that I want to do is use the switch( ) to
select statement.I know switch not allow the non-int type in it.But I
can't find a method to implement the selection statement.Could you give
me some advice?Addtional,I'm using J2SE 1.4.2,and has some reason I
can't not use J2SE1.5.