Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public class Some {
  2. private int ping;
  3. private String pong;
  4.  
  5. //Static members belongs to the class. There is no need of an object creation for use static members.
  6. public static final String birth = "Since 1895";
  7.  
  8. Some(int pi, String po) {
  9. this.ping = pi;
  10. this.pong = po;
  11. }
  12.  
  13. public String showTime() {
  14. return Integer.toString(this.ping) + " with " + pong;
  15. }
  16.  
  17. public static void main(String[] args) {
  18. String out = new Some(1, "pong").showTime();
  19. String since = Some.birth;
  20. System.out.println(out);
  21. System.out.println(since);
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement