/** * Person */ public class Person { private int id; private String name; public void setData(int no,String str){ id=no; name=str; } public void show(){ System.out.println(id+" "+name); } } public class PersonDemo { public static void main(String[] args) { Person p=new Person(); p.setData(101, "personone"); p.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