A class with a single integer field

Report a typo

You want to define a class with a single integer field. What is the correct way to do it?

a)

new MyClass() { }

b)

class MyClass() {
    int myField;
}

c)

MyClass {
    int myField;
}

d)

class MyClass {
    int myField;
}

e)

class MyClass {
    field int myField;
}
Select one option from the list
___

Create a free account to access the full topic