Question: another java program error..it says operator can not be applied to java.lang.double, java.lang.double!!! help! import java.io.*;\npublic class ThirdProgram\n{ \npublic static void main(String args[]) throws Exception\n{\nString sNumber;\nDouble dNumber, dSquare, dCube;\nBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\nSystem.out.print ("Input an integer: ");\nsNumber = br.readLine();\ndNumber = Double.parseDouble(sNumber);\ndSquare = dNumber*dNumber;\ndCube = dNumber*dNumber*dNumber;\nSystem.out.println ("The square of" + dNumber + "is" + dSquare);\nSystem.out.println ("The cube of" + dNumber + "is" + dCube);\n}\n}\n\nwhats the problem with this one??it says operator can not be applied to java.lang.double, java.lang.double

Answer: Use double, not Double. \nYou can't use the arithmetic operators you would normally use on primitives (i.e. double) on objects (i.e. Double). One solution would be to convert your Double objects into doubles using the doubleValue() method and do your calculations on those.
This question from the Yahoo Q&A forum is categorized in the topic: Science & Mathematics