Click here to Skip to main content
15,888,461 members
Home / Discussions / Java
   

Java

 
GeneralRe: Method Pin
Member 1147410126-Feb-15 13:51
Member 1147410126-Feb-15 13:51 
SuggestionRe: Method Pin
Richard MacCutchan24-Feb-15 0:12
mveRichard MacCutchan24-Feb-15 0:12 
Questioncompiling my code Pin
Member 1147410123-Feb-15 15:52
Member 1147410123-Feb-15 15:52 
SuggestionRe: compiling my code Pin
Richard MacCutchan23-Feb-15 21:51
mveRichard MacCutchan23-Feb-15 21:51 
Questionadding multiply and division method Pin
Member 1147410123-Feb-15 14:29
Member 1147410123-Feb-15 14:29 
AnswerRe: adding multiply and division method Pin
Akash gods23-Feb-15 17:06
professionalAkash gods23-Feb-15 17:06 
GeneralRe: adding multiply and division method Pin
Member 1147410124-Feb-15 3:35
Member 1147410124-Feb-15 3:35 
AnswerRe: adding multiply and division method Pin
Richard MacCutchan23-Feb-15 21:50
mveRichard MacCutchan23-Feb-15 21:50 
Java
double mathadd(){
return num1 + num2;
}

Your methods should accept local parameters rather than having some other method set them in advance, as shown below:
Java
double mathadd(double num1, double num2) {
    return num1 + num2;
}

The same with the subtraction method. You then call it with a stament like:
Java
double result = mytest1.mathadd(5.5, 7.12);

The setval method is redundant and should not be used. You also need to import the MathOP class into your test application, rather than trying to define them in your source.

Take a look at http://docs.oracle.com/javase/tutorial/java/index.html[^] for a more detailed explanation of how to write Java.
GeneralRe: adding multiply and division method Pin
Member 1147410126-Feb-15 14:05
Member 1147410126-Feb-15 14:05 
GeneralRe: adding multiply and division method Pin
Richard MacCutchan26-Feb-15 21:09
mveRichard MacCutchan26-Feb-15 21:09 
AnswerRe: adding multiply and division method Pin
Akash gods27-Feb-15 9:44
professionalAkash gods27-Feb-15 9:44 
SuggestionRe: adding multiply and division method Pin
Richard MacCutchan27-Feb-15 22:23
mveRichard MacCutchan27-Feb-15 22:23 
GeneralRe: adding multiply and division method Pin
Akash gods28-Feb-15 6:48
professionalAkash gods28-Feb-15 6:48 
GeneralRe: adding multiply and division method Pin
Richard MacCutchan28-Feb-15 6:55
mveRichard MacCutchan28-Feb-15 6:55 
QuestionWhat type of check is made in an ArrayList generic? Pin
Afzaal Ahmad Zeeshan22-Feb-15 7:06
professionalAfzaal Ahmad Zeeshan22-Feb-15 7:06 
AnswerRe: What type of check is made in an ArrayList generic? Pin
Richard MacCutchan22-Feb-15 7:38
mveRichard MacCutchan22-Feb-15 7:38 
GeneralRe: What type of check is made in an ArrayList generic? Pin
Afzaal Ahmad Zeeshan22-Feb-15 8:47
professionalAfzaal Ahmad Zeeshan22-Feb-15 8:47 
AnswerRe: What type of check is made in an ArrayList generic? Pin
jschell23-Feb-15 10:21
jschell23-Feb-15 10:21 
GeneralRe: What type of check is made in an ArrayList generic? Pin
Afzaal Ahmad Zeeshan23-Feb-15 20:26
professionalAfzaal Ahmad Zeeshan23-Feb-15 20:26 
GeneralRe: What type of check is made in an ArrayList generic? Pin
jschell26-Feb-15 9:50
jschell26-Feb-15 9:50 
Questionproject Pin
Member 1146518219-Feb-15 10:35
Member 1146518219-Feb-15 10:35 
AnswerRe: project Pin
Richard Andrew x6419-Feb-15 12:25
professionalRichard Andrew x6419-Feb-15 12:25 
AnswerRe: project Pin
Afzaal Ahmad Zeeshan22-Feb-15 6:55
professionalAfzaal Ahmad Zeeshan22-Feb-15 6:55 
Questionwhy calculation(BMI) is not working.... please help me... Pin
Member 1141203417-Feb-15 9:41
Member 1141203417-Feb-15 9:41 
GeneralRe: why calculation(BMI) is not working.... please help me... Pin
harold aptroot17-Feb-15 10:41
harold aptroot17-Feb-15 10:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.