Learn Java- Build a Droid


Hi everyone!

I am new to Java and programming in general. I am stuck on this free-form project, already on step six. What should be in the parentheses when I create a new instance of Droid named “Codey”?

Thanks in advance.

This is my code so far:

public class Droid {
  int batteryLevel = 100;
  String name;
  public Droid (String droidName){
    name = droidName;
  public static void main(String[] args){
    Droid codey = new Droid();

then "codey" should be between the parentheses.

instantiate a class, has the following general syntax:

new Class()

in your case, the class is named droid:

new Droid()

when you instantiate a class, the constructor is called:

// the constructor
public Droid (String droidName)

given your constructor has a parameter, you need to provide an argument when the class is instantiated:

new Droid("name of my droid here");
1 Like

Hello, I need your help. I am new in programming, I am stucked on this project buildin a Droid! Can anyone post the hole Project. There are things I can not understand and need help. I need to see the hole code to figure it out. The hints doesnt help. Thank you!