Monat: Mai 2016
Interfaces CAN contain implementation
Yes, it can! As Static nested inner class: public interface Obst { String getObstname(); // implizit: public int getAnzahl(); // implizit: public static class Obstmengenausgabe { static void print(Obst obst) { if (obst instanceof Birne) System.out.print("Obstsorte: Birne"); …
Read MoreAnonyme Innere Klassen
Code example: //interface interface Message{ String greet(); } public class My_class { //method which accepts the object of interface Message public void displayMessage(Message m){ System.out.println(m.greet() +", This is an example of anonymous inner calss as an argument"); } public static void main(String args[]){ //Instantiating the class…
Read MoreBest Eclipse hotkeys
F5: in die Methode gehen F6: Methode ausführen F7: Methode verlassen F10: RUN F11: Debug Sysout + Control + Space: Puts System.out.println() Control + Space: Auto-Complete Variable Or Function Name Control +…
Read MoreJava and Currency letter in Literals
Java allows any currency letter to be contained in Literals, this means that the following names are allowed: public class DemoCurrencySymbols { int çCent; int $Dollar; int Euro; int ¥Yen; int €Euro; int ¤CurrencySign; //int §invaldi; int ؋AfghanSign; int ₪NewShehelIsrael; int ₩WonKorea; int ₲GuaraniParaguay; …
Read More