Complete the code to declare a static integer variable named count.
public class Counter { public static int [1]; }
The static variable is named count as required.
Complete the code to access the static member count from the class Counter.
int currentCount = Counter.[1];Static members are accessed using the class name. Here, count is the static member.
Complete the code to access the instance member value without an object.
public class Item { public int value; } int x = Item.[1];
Instance members cannot be accessed directly from the class. This code causes an error because value is an instance member.
Fill both blanks to create an instance of Item and access its value member.
Item item = new [1](); int val = item.[2];
You create an instance of Item and access its instance member value.
Fill all three blanks to declare a static method that returns the static count variable.
public class Counter { public static int count; public static int [1]() { return [2].[3]; } }
The static method GetCount returns the static variable count accessed via the class name Counter.