# Compile Error in Java Program?

**URL:** <https://discourse.processing.org/t/compile-error-in-java-program/37533>\
**Category:** Coding Questions\
**Created:** [June 14, 2022, 6:10am UTC](https://discourse.processing.org/t/compile-error-in-java-program/37533 "2022-06-14T06:10:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shivambhatele](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/shivambhatele/32/16467_2.png) [@shivambhatele](https://discourse.processing.org/u/shivambhatele)\
**Post date:** [June 14, 2022, 6:10am UTC](https://discourse.processing.org/t/compile-error-in-java-program/37533/1 "2022-06-14T06:10:01Z")

</div>

Hello All, I’ve recently faced some issues… I’ve been following some online tutorials and added the code from given source, I modify it a little, and it doesn’t work.

First Java code which compiles on [Interviewbit](https://www.interviewbit.com/online-java-compiler/) compiler.

```auto
package newjavastoof;

public class NewJavaStoof {
    private String girlName;
    public void setName(String name)
    {
        girlName = name;
    }
    public String getName()
    {
        return girlName;
    }
    public void saying()
    {
        System.out.printf("your first girlfriend was %s", getName());
    }
}

```

2nd part of the code that doesn’t compile on line 11 and 12

```auto
package newjavastoof;
import java.util.Scanner;

public class Stoof {
    public static void main(String[] args)
    {
        Scanner imput = new Scanner(System.in);
        Stoof stoofObject = new Stoof();
        System.out.println("Enter name of first gf here: ");
        String temp = imput.nextLine();
        stoofObject.setName(temp);
        stoofObject.saying();

    }   
}

```

What’s wrong with it? I cant understand, Can anyone suggest me?

---

<div class="post-metadata">

**Author:** ![mnse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnse/32/16520_2.png) [@mnse](https://discourse.processing.org/u/mnse)\
**Post date:** [June 14, 2022, 12:26pm UTC](https://discourse.processing.org/t/compile-error-in-java-program/37533/2 "2022-06-14T12:26:40Z")

</div>

Oh my goodness,

1. This is a processing forum not a java forum
2. Your question is labled as p5js your code is  
obvisiously not.
3. and you are instanciate a new Stoof object and the class doesn’t seem to have a setname etc methods only a main. Guess you want a NewJavaStoof one.

Cheers  
—mnse
