PDA

View Full Version : char vars may inserted as method parameters ?



leonidassavvides
08-24-2009, 06:32 PM
char vars may inserted as method parameters ?
int setAAA (int varAAA) {...} the first int in a setter is error ?
void is required whereas we have no return data ?
char vars may compared with == or need...?
constructors may output text ? but no return data ?
why does not compile the below:


class Test2
{
public static void main(String[] args)
{
char grade = 'A';

int process(char grade)
{
int points = (grade == 'A' ? 4 : 3);
return points;
}

System.out.println(process(grade));

}
}

techietim
08-25-2009, 01:55 PM
class Test2
{
public static void main(String[] args)
{
char grade = 'A';
System.out.println(process(grade));
}
private static int process(char grade)
{
int points = (grade == 'A' ? 4 : 3);
return points;
}
}