Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. package mobile;
  2.  
  3. /**
  4. * @param args the command line arguments
  5. */
  6.  
  7. public static void main(String[] args) {
  8.  
  9. public class Mobile {
  10. int volume = 0;
  11. int ringtone = 0;
  12.  
  13. void volumeUp (int increment){
  14. volume = volume + increment;
  15. }
  16. void changeringtone (int newValue){
  17. ringtone = newValue;
  18. }
  19. void volumeDown (int decrement){
  20. volume = volume - decrement;
  21. }
  22. void printStates(){
  23. System.out.println("ringtone:" + ringtone + "volume:" + volume);
  24. }
  25.  
  26. java.lang.NoClassDefFoundError: mobile/Mobile (wrong name: mobile/mobile)
  27. at java.lang.ClassLoader.defineClass1(Native Method)
  28. at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
  29. at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
  30. at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
  31. at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
  32. at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
  33. at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
  34. at java.security.AccessController.doPrivileged(Native Method)
  35. at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
  36. at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
  37. at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  38. at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  39.  
  40. public class Mobile {
  41. //Variables declarations
  42. //Instance blocks etc.,
  43. public static void main(String[] args) {
  44.  
  45. //Your code here
  46. }
  47.  
  48. }
  49.  
  50. public class Me {
  51. public static void main(String[] args) {
  52. Mobile myPhone = new Nokia(); // we "buy" a mobile
  53. myPhone.setVolume(11); // that's more then 10 ;)
  54. }
  55. }
  56.  
  57. public interface Mobile {
  58. void setVolume(int level); // as an example
  59. }
  60.  
  61. public class Nokia implements Mobile {
  62. // (1) a constructor
  63. // (2) implementations for all methods defined on Mobile
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement