// class Fruit public class Fruit { public String name; public double weight; Fruit(String name){ this.name = name; this.weight = Math.random()*0.3+0.5; } public void show(){ System.out.println(name + " " + weight); } } // class PJJJeden public class PJJJeden { public static void main(String[] args) { //--------------------------// Fruit fruit = new Fruit("Cherry"); fruit.show(); //--------------------------// } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter