pr println("_"); println("_"); gr raam: setTitle setVisible + method joonistada raam.setTitle("_"); raam.setVisible(true); void joonistada(Tahvel t, Graphics g) Given: panel t (in the frame 'raam') and its graphic context g Result: drawing in the frame t.setBackground(Color.white); g.setColor(Color.blue); g.setFont(new Font("Monospaced", Font.PLAIN, 18)); g.drawString("Author: Alger Javer", 15, 20); g.setColor(Color.green); g.drawRect(40,40,400,400); g.drawLine(40,40,400,400); g.setColor(Color.red); g.fillOval(235,45,100,100); rand method: a random int/double number from half-interval int/double random(int/double a, int/double b) Given: numbers a>=0 and b>=0 Result: returns a random number from half-interval [a; b) (if a > b then from half-interval [b; a)) return (int/double)(a + Math.random()*(b - a)); round round double (2-digits-precision) (Math.round(_ * 100) / 100.0) s2i String to int Integer.parseInt(_) s2d String to double Double.parseDouble(_) sort method: sort array int/double[] void sort(int/double[] a) Given: a[0], a[1], ..., a[n] for value of current element int/double b; i = 1 .. a.length-1 b = a[i]; int j = i - 1; for( ; a[j] > b ; ) shift right a[j] a[j+1] = a[j]; if (j-- == 0) break; location for b found: a[j+1] a[j+1] = b; beep java.awt.Toolkit.getDefaultToolkit().beep(); sleep try millisec Thread.currentThread().sleep(_); catch (InterruptedException e) from readerFrom text file BufferedReader _ = readerFrom(_); to writerTo text file PrintWriter _ = writerTo(_); io process (copy) text file try source file name String from = _; BufferedReader sfail = readerFrom(from); output file name String to = _; PrintWriter vfail = writerTo(to); copy: String line = ""; read line and check end of file while((line = sfail.readLine()) != null) write line to output file vfail.println(line); finish: sfail.close(); vfail.close(); catch (IOException e) System.err.println(e.getMessage()); record data record inner class class _ only data fields: