// Create a class called Dog containing two String: name and says. In main(), create two dogs objects
and assign it to spot's object.
class Dog {
String name;
String says;
}
public class DogSays {
public static void main(String[] args) {
Dog D1 = new Dog();
Dog D2 = new Dog();
D1.says = "Woof!";
D1.name = "Scruffy!";
D2.says = "Bark!";
D2.name = "Spot!";
System.out.println("Hi! My name is " + D1.name);
System.out.println(D1.says);
System.out.println("Rooooooooowr! I'm " + D2.name);
System.out.println(D2.says);
}
}
나는 한 시간 동안 이것을 확인해 왔으며 무엇이 잘못된 것인지 전혀 모른다. 나는 클래스, 열거 형, 또는 인터페이스 오류가 예상되고 또한 닫히지 않은 문자 리터럴을 얻는다. 제 생각에 그것은 따옴표가있는 것으로 생각합니다.닫지 않은 문자 리터럴
코드가 컴파일되었습니다. –
코드가 잘 작동하고 있는데, 무엇이 문제입니까? 오류를 게시 할 수 있습니까 ?? –
출력이'안녕하세요! 내 이름은 초라한이야! 위! Rooooooooowr! 나는 스팟이야! 나무 껍질! –