using System; namespace ConsoleApp2 { class Program { class sw_class { private int x;//グローバルクラス変数1 private int y;//グローバルクラス変数2 public sw_class(int x1, int y1) { this.x = x1; this.y = y1; } public void swap() { int x_save = 0; x_save = this.x; this.x = this.y; this.y = x_save; return; } public void sw_show() { Console.WriteLine("(x={0},y={1})を表示します。", x, y); return; } } static void Main(string[] args) { Console.WriteLine("Hello World!"); sw_class w1 = new sw_class(10,5); w1.sw_show(); w1.swap(); w1.sw_show(); w1.swap(); w1.sw_show(); } } }