Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. package com.javarush.test.level15.lesson04.task05;
  2.  
  3. /* Все лишнее - прочь!
  4. Убрать в методе main лишние строки, для которых метод add нереализован.
  5.  
  6. public class Solution {
  7. public static void main(String[] args) {
  8. JuniorJavaDev me = new JuniorJavaDev();
  9. System.out.println(me.askHubert("What do you think about level15.lesson06.task01?"));
  10. System.out.println(me.askZapp("When will be the next update?"));
  11. }
  12.  
  13. public interface SpecificSerializable extends Serializable {
  14. }
  15.  
  16. public static class JavaDev extends Object implements SpecificSerializable {
  17. String answerQuestion(String question) {
  18. return String.format("I'll be thinking of [%s]", question);
  19. }
  20. }
  21.  
  22. public static class JuniorJavaDev extends Object, JavaDev implements SpecificSerializable {
  23. JavaDev zapp = new JavaDev();
  24. JavaDev hubert = new JavaDev();
  25.  
  26. String askZapp(String question) {
  27. return zapp.answerQuestion(question);
  28. }
  29.  
  30. String askHubert(String question) {
  31. return hubert.answerQuestion(question);
  32. }
  33. }
  34. }
  35. */
  36.  
  37. public class Solution {
  38. public static void main(String[] args) {
  39. add((short) 1, 2f);
  40. add(1, 2);
  41. add(2d, 2);
  42. add((byte) 1, 2d);
  43. }
  44.  
  45. public static void add(int i, int j) {
  46. System.out.println("Integer addition");
  47. }
  48.  
  49. public static void add(int i, double j) {
  50. System.out.println("Integer and double addition");
  51. }
  52.  
  53. public static void add(double i, double j) {
  54. System.out.println("Double addition");
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement