Advertisement
Guest User

Untitled

a guest
May 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. package spielwiese.motortype;
  2.  
  3. class Motor {
  4.     Motor(char m) {
  5.         char motorType = m;
  6.        
  7.         if (motorType == 'e' || motorType == 'E') {
  8.             System.out.println("Auto wird mit einem E-Motor gebaut.");
  9.         }
  10.    
  11.         if (motorType == 'o' || motorType == 'O') {
  12.             System.out.println("Auto wird mit einem O-Motor gebaut.");
  13.         }
  14.        
  15.         if (motorType == 'd' || motorType == 'D') {
  16.             System.out.println("Auto wird mit einem O-Motor gebaut.");
  17.         }
  18.     }
  19. }
  20.  
  21. public class Auto {
  22.     String name;
  23.     Motor motor = new Motor('O');
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement