Hi,
I have been struggling in this program for 2 days.I am new to programming.
please help me.
public static void operation1 (
String[] dbcolumn1){
int s=Integer.parseInt( dbcolumn1[0]);
int s1=Integer.parseInt(dbcolumn1[2]);
if (dbcolumn1[1].equals("+")) {
dbcolumn1[2]=dbcolumn1[0] + dbcolumn1[2];
System.out.println(dbcolumn1[2]);
}
else if (dbcolumn1[1].equals("*")) {
dbcolumn1[2]= dbcolumn1[0] * dbcolumn1[2]; //1
}
else if (dbcolumn[1].equals("-")){
dbcolumn1[2]= dbcolumn1[0] * dbcolumn1[2]; //2
}
else if (dbcolumn1[1].equals("/")) {
dbcolumn1[2]= dbcolumn1[0] * dbcolumn1[2]; //3
}
}
Question 1)
In the above method,the display line
System.out.println(dbcolumn1[2]);
should not give 1+2 total 3.why?
Question 2)
lines 1,2,3 showng these operators should not apply to String
Please help me to find out what i am doing wrong?