As the solution is already given in the comments, here a clean code for that.
That might make things a little easier to understand.
public class Project1 {
public static void main(String[] args) {
Project1 project = new Project1();
int nom = project.assigner();
System.out.println("nom is: " + nom);
}
private int assigner()
{
int t = 7;
return t;
}
}
have fun!