package ics.sample; import java.awt.*; import java.util.Scanner; public class Sample { Computer computer1; Computer computer2; public Sample () { System.out.println ("ics is fun with my " + new Computer("hp", "desktop")); computer1 = new Computer(); Color color = Color.cyan; computer1.setColor (color); System.out.println ("and with my " + computer1); System.out.println ("and with my " + computer1.toString()); System.out.println ("my strange computer " + computer2); System.out.println ("my strange computer " + computer2.toString()); System.err.println ("division by 0 " + 1 / 0); System.out.println ("ics is fun in my class " + 111); System.out.println ("ics is fun with point " + new Point(10, 20)); } /** Starts the application * @param args ignored */ public static void main (String [] args) { new Sample (); } } class Computer { String kind; String brand; Color color; Color interiorColor; Computer() { Scanner scanner = new Scanner (System.in); System.out.print ("your computer kind: "); kind = scanner.nextLine(); System.out.print ("your computer brand: "); brand = scanner.nextLine(); } Computer (String brand1, String kind) { this.kind = kind; brand = brand1; setColor (Color.orange); } public void setColor (Color color, Color interiorColor) { this.color = color; this.interiorColor = interiorColor; } public void setColor (Color color) { this.color = color; } public String toString () { return brand + " " + kind; } }