I am getting this error:

Main.java:2: error: class LinkedList is public, should be declared in a file named LinkedList.java
public class LinkedList {
^
1 error

How can i change file name?? and m not allow to modify any code, only allow to write function code

@Vipin_coder,
Change class name from LinkedList to Main everywhere in your code. Change constructor names too.

@Vipin_coder,
Another solution to this can be to create a Main class and copy the main method into that main class. And then call the LinkedList class methods from the main class.

but it is a function problem, i should write code inside the given function only

You write your function.

Before you submit your code, just change LinkedList to Main everywhere in your code.

okay but there is total 12 questions, i think i will get same error in each problem, there is no any Main class in any question. and after writing my code , code is also not auto save if want to complete a particular problem after some time, then i need to write whole code again.

@Vipin_coder,
No no. Just change the class name. Nothing else.