We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
class Calculate {
public static Scanner sc =new Scanner(System.in);
~~~~
public void checkString(String s){
if (s.startsWith("-")|| Double.valueOf(s)<=0)
throw new NumberFormatException("All the values must be positive");
}
~~~~~
public class Output {
public void display(double volume) {
~~~~~
if(Double.valueOf(s)>0)
System.out.println(s);
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Detect the Email Addresses
You are viewing a single comment's thread. Return to all comments →
Change your code like the below.