gudii9
asked on
some methods private some are not
Hi,
I was going through below link
http://www.homeandlearn.co.uk/java/more_class_methods.html
I wonder why getGrade() method is private and other methods are not private.
As it is private getGrade() is being called by separate method examGrade() method using this.getGrade ()
I feel it is bit round about approach.
i was not able to copy source code to run. How do i copy and then paste to eclipse?
please advise
I was going through below link
http://www.homeandlearn.co.uk/java/more_class_methods.html
I wonder why getGrade() method is private and other methods are not private.
As it is private getGrade() is being called by separate method examGrade() method using this.getGrade ()
I feel it is bit round about approach.
i was not able to copy source code to run. How do i copy and then paste to eclipse?
please advise
As soon as I read the title I knew this was a gudii9 question.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> How do i copy and then paste to eclipse
Much of the code on this site are pictures. In IE, right-clicking on the code gives a popup, and one of the options is Save Picture As. You can copy some of the code, such as:
Much of the code on this site are pictures. In IE, right-clicking on the code gives a popup, and one of the options is Save Picture As. You can copy some of the code, such as:
String examGrade(int aScore) {
Exam_Grade = this.getGrade( aScore) ;
return Exam_Grade;
}
Exam_Grade = this.getGrade( aScore) ;
return Exam_Grade;
}
>> I wonder why getGrade() method is private and other methods are not private.
>> I feel it is bit round about approach.
I think they are just trying to introduce topics in a haphazard round about approach. I wouldn't make too much of it nor try to use their teaching style as a guideline on good design practices. Their point is:
>> I feel it is bit round about approach.
I think they are just trying to introduce topics in a haphazard round about approach. I wouldn't make too much of it nor try to use their teaching style as a guideline on good design practices. Their point is:
Notice that this method is private. Just like field variables, making a method private means it can only be seen inside of this class. It can't be seen by the ExamDetails class.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> i was not able to copy source code to run
If you want to master a language, then I suggest that you type a sample program in and deal with your typos by trying to understand the sometimes cryptic error messages that you get. Learning how to debug a program on your own without bothering your colleagues in the workplace is one of the important steps in becoming a professional. Tracking down the cause of the error message will also force you to think a bit more about what you typed in.
If you want to master a language, then I suggest that you type a sample program in and deal with your typos by trying to understand the sometimes cryptic error messages that you get. Learning how to debug a program on your own without bothering your colleagues in the workplace is one of the important steps in becoming a professional. Tracking down the cause of the error message will also force you to think a bit more about what you typed in.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you for the links. I will explore them