Write a program to produce runtime error java.lang.NoSuchMethodError
Answers
Answered by
0
Answer:
I not understand your question plzzz ask again okkk bhai and I have to say that the ans
Answered by
0
Explanation:
public class Loan{
public String TestMessage(){
return "Personal Loan";
};
}
If you try to execute this using javac Loan.java, it will produce NoSuchMethodError.
If any "method is not found" in the class and if the object of the class try to call it, it produce "NoSuchMethodError". It will not provide any compilation error as this will be thrown only at the "run time".
In the above example, "Java" always need "main()" and main() is the first function which is called automatically. Here, main() is not found so, it throws "NoSuchMethodError".
To Learn more:
https://brainly.in/question/1089786
https://brainly.in/question/8556790
Similar questions