Added New Classes

BAEL-4193 NoSuchMethodError
This commit is contained in:
Rutuja Joshi 2020-08-05 15:07:34 +05:30 committed by GitHub
parent e7ec3ff7bc
commit 5db4e332b9
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,20 @@
package com.baeldung.exceptions.nosuchmethoderror;
import java.util.StringJoiner;
public class MainMenu {
public static void main(String[] args) {
System.out.println("Today's Specials: " + getSpecials());
}
public static StringJoiner getSpecials() {
StringJoiner specials = new StringJoiner(", ");
try {
specials.add(SpecialToday.getStarter());
specials.add(SpecialToday.getDesert());
} catch (Exception e) {
e.printStackTrace();
}
return specials;
}
}

View File

@ -0,0 +1,14 @@
package com.baeldung.exceptions.nosuchmethoderror;
public class SpecialToday {
private static String desert = "Chocolate Cake";
private static String starter = "Caesar Salad";
public static String getDesert() {
return desert;
}
public static String getStarter() {
return starter;
}
}