Please login to save your progress.
Visibility and Accessibility Modifiers
Exercise: Use the static modifier
Goal
Modify the example class
- Modify the 'NewLine' property to make it static.
- Add a new static method to the class called Version, of type 'int' which returns the number 4.
x
1
using System;
2
3
public static class Environment
4
{
5
public string NewLine { get; set; }
6
}
7
8
public static class Program
9
{
10
public static void Main()
11
{
12
Environment.NewLine = "\r\n";
13
14
int version = Environment.Version();
15
}
16
}
Page 11 of 18