Hi,
I am new to the java world.
I am getting the following error.
ClassB.java:62: incompatible types
found : int
required: order.ClassB
return Integer.parseInt(conString);
This what I am trying to do..
I have two classes. Class A and Class B. Class A calls a method located in Class B (refer to code below).
Class A
Product prod = null;
ComputerPart compart = new ComputerPart();
prod = compart.getComputerPart();
Class B
I have three local variables (xdesc,xmfg,xprice) and I have three instance variables defined (instDesc,instMfg,instPrice). instDesc and instMfg are String variables and instPrice is a float variable. the local variables are assigned to the instance variables.
Then I converted the float variable instPrice to String and concentated call three variable into a Sting variable called conString. then try to return conString back the variable called prod in the calling class (Class A).
public Class B getComputerPart() {
.
.
.
instDesc = xdesc;
instMfg = xmfg;
instPrice = xprice;
String floatToString=Float.toString(instPrice);
String conString = instDesc+instMfg+floatToString;
return Integer.parseInt(conString);
}
any assistance on what I can do to convert the string variable conString to a type that is accepted by the prod variable in Class A. in addition, I believe it may have something to do with the following line of code in ClassA "Product prod = null". prod will not accept conString.