[C# Java] 1차원 배열의 초기화 방법에 대해서 알아보자. // [C# Java] OK. Since arrays are objects, we need to instantiate them with the new keywordint[] myArray = new int[3];myArray[0] = 10;myArray[1] = 20;myArray[2] = 30; // [C#] OK. We can provide initial values to the array when it is declared by using curly brackets// [Java] Error. We can not define dimension expressions when an array initializer is providedint..
Logical Operator [C# C++ Java] 공통 Operator Logical Bitwise ! NOT YES - && AND YES - || OR YES - != XOR YES - Logical Operator [Python]OperatorLogicalBitwisenotNOTYES-andANDYES-orORYES-!=XORYES- Bitwise Operator [C# C++ Java Python] 공통 Operator Logical Bitwise ~ NOT - YES & AND can be used YES | OR can be used YES ^ XOR can be used YES 아래와 같이 Logical XOR Function(Method)을 정의해서 사용해도 된다. // [C#] Lo..
참고 :[C#] switch Statement[C++] switch Statement[Java] switch Statement[C# vs Java] Flow Control switch 구문에서 fall-through 지원 여부를 C# C++ Java 각각에 대해 알아보자. C# C++ Java 공통 코드는 아래와 같다. int number = 2;switch (number){case 1: // print "one" statement for C# C++ Java respectively break;case 2: // print "two" statement for C# C++ Java respectively break;case 3: // print "three" statement for C# C++ Java ..
// C# : Named Arguments using System; namespace Sharp1{ class Program { static void Main(string[] args) { Work(b: "Big", a: "Ace"); // Named Arguments } static void Work(string a, string b) { Console.WriteLine("a: " + a); Console.WriteLine("b: " + b); } }} /* Outputa: Aceb: Big*/
// C# : Optional Arguments using System; namespace Sharp1{ class Program { static void Main(string[] args) { int result = Sum(2); Console.WriteLine(result); } static int Sum(int x, int y = 3) // Optional Arguments { return x + y; } }} /* Output5*/