Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 12 - char
- 13 - Math.E;
- 35 - should be import java.text.NumberFormat;
- 44 - you need to import number format to use the class in your program
- 55 - import javax.swing.JOptionPane;
- import java.util.*;
- import java.util.Scanner.*;
- public class Test {
- public static void main(String[] args){
- Scanner scan = new Scanner(System.in);
- String input = JOptionPane.showInputDialog(null, "input a file name (ex: index.html) ");
- String web = scan.next();
- JOptionPane.showMessageDialog(null,"your extension is" + web);
- }
- }
- 56 - import javax.swing.JOptionPane;
- import java.util.*;
- import java.util.Scanner.*;
- public class tes56 {
- public class Test2 {
- public static void main(String[] args){
- space = input.indexOf(' ');
- firstName = input.substring(0, space);
- Scanner sandy = new Scanner(System.in);
- String input = JOptionPane.showInputDialog(null, "please enter your full name ");
- String name = sandy.next();
- JOptionPane.showMessageDialog(null,"Hello" + firstName );
- }
- }
- }
- 71 - The method generally used to convert String to Integer in Java is parseInt(). Sometimes we may have a number that is represented as a String, for example:
- "13" "12" "11"
- If we want to see if "11" is less than "12" we cannot, because Java just sees those numbers as strings. To Java, "12", is no different than saying "twelve". If we want to compare numbers then we would require Integers to do so. In some cases our programs may receive a string that contains an integer and in order for us to use the value in the string as an Integer we need to parse the integer from the string to obtain a valid Integer.
- 72 - Math class is available to any java program; you don't need to use the import statement The math class provides 2 static constants and a number of static methods that save the programmer from writing some complex mathematical codes.
Add Comment
Please, Sign In to add comment