I am new coder taking a class over computer science. We are working with Java. The assignment was given through a pdf that I reuploaded as a photo here https://i.sstatic.net/xNEdm.png. Here is my code so far.
public class LineEditor { private String myLine; public void insert(String str, int index) { String newmyLine = myLine; newmyLine = " world!"; String sub = myLine.substring(0, index); String sub2 = myLine.substring(index, myLine.length()-1); System.out.print(sub + str + sub2); } } public void delete(String str) { } public void deleteAll(String str) { } public static void main(String[] aghs){ insert("Hello ", 0); } } When I run this, I get the error: Cannot make a static reference to the non-static method insert(java.lang.String, int) from the type LineEditor
How can I take the insert method and use it in the main method? If any of my terminology is off, go ahead and tell me as well.
insertstatic