Cd Key Essay

73356 Words Sep 19th, 2014 294 Pages
Java Quick Reference Console Input Scanner input = new Scanner(System.in); int intValue = input.nextInt(); long longValue = input.nextLong(); double doubleValue = input.nextDouble(); float floatValue = input.nextFloat(); String string = input.next(); Console Output System.out.println(anyValue); JOptionPane.showMessageDialog(null, "Enter input"); GUI Input Dialog String string = JOptionPane.showInputDialog( "Enter input"); int intValue = Integer.parseInt(string); double doubleValue = Double.parseDouble(string); Message Dialog

Primitive Data Types byte short int long float double char boolean 8 bits 16 bits 32 bits 64 bits 32 bits 64 bits 16 bits true/false

Arithmetic Operators + * / % ++var --var var++ var-addition subtraction
…show more content…
le.parseDouble(string) Arrays.sort(type[] list) Arrays.binarySearch(type[] list, type key) Array/Length/Initializer int[] list = new int[10]; list.length; int[] list = {1, 2, 3, 4}; Multidimensional Array/Length/Initializer int[][] list = new int[10][10]; list.length; list[0].length; int[][] list = {{1, 2}, {3, 4}}; Ragged Array int[][] m = {{1, 2, 3, 4}, {1, 2, 3}, {1, 2}, {1}};

Text File Output PrintWriter output = new PrintWriter(filename); output.print(...); output.println(...); output.printf(...); Text File Input Scanner input = new Scanner( new File(filename));

File Class File file = new File(filename); file.exists() file.renameTo(File) file.delete()

Object Class Object o = new Object(); o.toString(); o.equals(o1);

Comparable Interface c.compareTo(Comparable) c is a Comparable object

String Class String s = "Welcome"; String s = new String(char[]); int length = s.length(); char ch = s.charAt(index); int d = s.compareTo(s1); boolean b = s.equals(s1); boolean b = s.startsWith(s1); boolean b = s.endsWith(s1); String s1 = s.trim(); String s1 = s.toUpperCase(); String s1 = s.toLowerCase(); int index = s.indexOf(ch); int index = s.lastIndexOf(ch); String s1 = s.substring(ch); String s1 = s.substring(i,j); char[] chs = s.toCharArray(); String s1 = s.replaceAll(regex,repl); String[] tokens = s.split(regex);

ArrayList Class ArrayList list = new ArrayList(); list.add(object); list.add(index, object); list.clear(); Object o = list.get(index); boolean b =

Related Documents