Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package spielwiese.motortype;
- class Motor {
- Motor(char m) {
- char motorType = m;
- if (motorType == 'e' || motorType == 'E') {
- System.out.println("Auto wird mit einem E-Motor gebaut.");
- }
- if (motorType == 'o' || motorType == 'O') {
- System.out.println("Auto wird mit einem O-Motor gebaut.");
- }
- if (motorType == 'd' || motorType == 'D') {
- System.out.println("Auto wird mit einem O-Motor gebaut.");
- }
- }
- }
- public class Auto {
- String name;
- Motor motor = new Motor('O');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement