Tutaq ki, ashagidaki formada bir class yaratmishiq : public class User { public String name ; public String username ; public int age ; public static String test ; public void foo (){} public static void foo2 (){} } application u run etdikde, javac .java fayllarini compile edib .class bytecodelarini yaratdiqdan sonra java, yeni JVM ishe dushur. Yalniz ehtiyaci oldugu classlari yaddasha yukleyir. Meselen, main methodunda, User classinin static metodunu cagiraq, bu zaman class load olunacaq ve ya class a ehtiyac duyulan diger hallarda. Eger kod hemin class a ehtiyac duymasa, bu class yaddasha yuklenmir. JVM yaddash da yer ayiran vaxti static acar sozu olanlari da class terkibinde saxladir. Yeni yaddash da onlar uchun de ayrica yer ayirir. Static - yeni stabil kimi de basha dushule biler. Bu classi i istifade etmek isteyende, yeni User. yazib classin icinde olan deyishen ve metodlara chatmaq isteyende yalniz static olanlar gorsen...
Number bir neche formada gele biler bize. Meselen, 99451xxxxxxx 99455xxxxxxx ve s. 051xxxxxxx 055xxxxxxx ve s. 51xxxxxxx 55xxxxxxx ve s. Bu nomreleri standart formaya salmaq uchun kichik kod : public static String validate (String number){ final String prefix = "994" ; if (number.length() == 12 && number.matches( "^(994)+(50|51|55|70|77|99).*$" )) { return number ; } else if (number.length() == 10 && number.matches( "^(0)+(50|51|55|70|77|99).*$" )) { return prefix + number.substring( 1 ) ; } else if (number.length() == 9 && number.matches( "^(50|51|55|70|77|99).*$" )) { return prefix + number ; } return null; } sonda bize qayidan netice 99451xxxxxxx ve ya 99455xxxxxxx sheklinde olacaq. Eger null qayidarsa, bu methodun cagrildigi yerde uygun helli etmek olar.