+ 1
just started oops in java ad getting an error
public class getterssetters { public static void main(String[] args) { pen p1 = new pen(); p1.setcolor("blue"); System.out.println(p1.getcolor()); } } class pen{ private String color; private int tip; String getcolor() { return this.color; } int gettip() { return this.tip; } void setcolor(String newcolor) { color = newcolor; } void settip(int tip) { this.tip = tip; } } error - Exception in thread "main" java.lang.NoSuchMethodError: 'void oops.pen.setcolor(java.lang.String)' at oops.getterssetters.main(getterssetters.java:8) output shuld be: blue
4 ответов
+ 6
You can link your code like this:
Go to Code section, click +, select the programming language, insert your **complete** code, save.
Come back to the thread, click +, Insert Code, sort for My Code Bits, select your code.
+ 2
RISHABH BHUTANI
Recheck this code once.. It should work.
+ 2
Sorry, maybe it was a problem with my java debugger in vs code, i reinstalled that and my code is working now!
I checked how to upload the link of the code.
Thanks everyone