You’re missing the multiplication operator. Also, you want to do 4/3
in floating point, not integer math.
volume = (4.0 / 3) * Math.PI * Math.pow(radius, 3); ^^ ^
Related Posts:
- What exactly is Apache Camel?
- How does the Java ‘for each’ loop work?
- How does the Java ‘for each’ loop work?
- What does “Could not find or load main class” mean?
- What is the proper way to handle a NumberFormatException when it is expected?
- How to convert/parse from String to char in java?
- Is there a Heap in java?
- Error parsing data org.json.JSONException: Value
- What is the difference between a static method and a non-static method?
- What is Java Servlet?
- Non-static variable cannot be referenced from a static context
- Round a double to 2 decimal places [duplicate]
- EOFException – how to handle?
- A long bigger than Long.MAX_VALUE
- How to fix array index out of bounds error?
- Initialize List
- > in Java
- How do I limit the number of decimals printed for a double?
- “No X11 DISPLAY variable” – what does it mean?
- java.io.FileNotFoundException: the system cannot find the file specified
- Java integer list
- I want to declare an empty array in java and then I want do update it but the code is not working
- The @ symbol in java
- Error: Could not find or load main class in intelliJ IDE
- How to connect to FTP over TLS/SSL (FTPS) server in Java
- How to check type of variable in Java?
- Convert .class to .java
- Recursive print Factorial
- What is Serialization?
- What is the best/simplest way to read in an XML file in Java application?
- Received fatal alert: handshake_failure through SSLHandshakeException
- Why would a “java.net.ConnectException: Connection timed out” exception occur when URL is up?
- HashSet vs. ArrayList
- restart console on Minecraft Server
- SSL peer shut down incorrectly in Java
- Java split string to array
- Censored Words Condition
- Get all unique values in a JavaScript array (remove duplicates)
- Removing whitespace from strings in Java
- org.glassfish.jersey.servlet.ServletContainer ClassNotFoundException
- Generate a random double in a range
- How to get locator of current web element?
- Polymorphism vs Overriding vs Overloading
- javac: file not found: first.java Usage: javac
- java.net.SocketException: Connection reset
- (The Triangle class) Design a class named Triangle that extends GeometricObject
- Java – How to do floor division?
- Short form for Java if statement
- Access restriction: The type ‘Application’ is not API (restriction on required library rt.jar)
- Web server failed to start. Port 8080 was already in use. Spring Boot microservice
- local variables referenced from an inner class must be final or effectively final
- Java and Windows – error: illegal escape character
- Bank Account Java Program
- “Javac” doesn’t work correctly on Windows 10
- Eclipse error, “The selection cannot be launched, and there are no recent launches”
- RecyclerView onClick
- Failed to load the JNI shared Library (JDK)
- Java Error: Invalid top level statement
- IntelliJ – Can’t start – “JAVA_HOME does not point to a valid JVM installation”
- Syntax error on token(s), misplaced construct(s)
- Class is not Abstract and does not Override error in Java
- JAVA Variable declaration not allowed here
- Comparing strings by their alphabetical order
- exposed beyond app through ClipData.Item.getUri
- Java word count program
- How to write an ArrayList of Strings into a text file?
- MultipartException: Current request is not a multipart request
- difference between equals() and hashCode()
- The C# Shorthand getters and setters
- try catch ArrayIndexOutOfBoundsException?
- how to make jni.h be found?
- Cannot resolve symbol ‘button’ -Android Studio
- Syntax error on token “;”, { expected after this token in Random string creator
- Two dimensional array list
- Java: How To Call Non Static Method From Main Method?
- What does idempotent method mean and what are the side effects in case of calling close method of java.lang.AutoCloseable?
- How to “wait” a Thread in Android
- How to use regex in String.contains() method in Java
- Error: Module not specified (IntelliJ IDEA)
- Why is there no multiple inheritance in Java, but implementing multiple interfaces is allowed?
- What’s the difference between JPA and Hibernate?
- Throwing multiple exceptions in Java
- fixing errors on a program to call methods in java
- How can I calculate a time difference in Java?
- Any shortcut to initialize all array elements to zero?
- Creating a Calendar using javafx
- Align printf output in Java
- How to print binary tree diagram in Java?
- Must qualify the allocation with an enclosing instance of type GeoLocation
- How to get rows and columns count of a 2D array in Java?
- Difference between volatile and synchronized in Java
- intellij idea – Error: java: invalid source release 1.9
- How fix Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
- Is it okay to throw NullPointerException programmatically?
- Read next word in java
- Exception in thread “AWT-EventQueue-0” java.lang.OutOfMemoryError: Java heap space
- How to enable the Java keyword assert in Eclipse program-wise?
- return an ArrayList method
- How can I catch all the exceptions that will be thrown through reading and writing a file?
- How to convert java.util.Date to java.sql.Date?
- How can I design a class named allergy?