Java(Android), Objective-C, Swift(iOS), Python 문법비교

2018. 5. 18. 18:10Development/[Dev] 개발일반

728x90

Java(Android), Objective-C, Swift(iOS), Python 문법비교



구분

Java

 Objective-C

 Swift

 Python

 C#

 import

  •  import android.content.Context
  • #import "AppDelegate.h"
  • #import <AdSupport/AdSupport.h>
  •  import Foundation
  • import math
  • from math import ceil, floor
  •  using System;

 콘솔출력

  •  System.out.println("Hello World");
  • Log.v("tag", "Hello World");
  • printf(@"Hello World");
  • NSLog(@"Hello World");

  • print("Hello World") 
  •  Swift.print("Hello World")
  •  print("Hello World") 
  •  Console.WriteLine("Hello World");

 함수정의

  • public static void Hello() {}
  • public static String Hello(String s) { return ""; }
  • public static void Hello() {}
  • public static String Hello() { return ""; }
  • - (void) Hello {}
  • - (NSString *)Hello { return @"" }
  • - (void) Hello:(NSString*) name good: (BOOL) good {}
  • - (NSString *) Hello:(NSString*) name good: (BOOL) good { return @"" }
  • func Hello() {}
  • func Hello(_ name: String) {}
  • func Hello(name: String) {}
  • func Hello(_ name: String) -> String { return "" }
  • func Hello(name: String) -> String { return "" }
  • def Hello():
  • def Hello(s):
  • def Hello():

   return ""

  • def Hello(s):

   return "" 

  • public static void Hello();
  • public static void Hello(string s);
  • public static string Hello() {  return ""; }
  • public static string Hello(string s) { return ""; }
 함수호출
  • this.Hello();
  • this.Hello("World");
  • [self Hello];
  • [self Hello:@"World"];
  • [self Hello:@"World" good:YES];
  • self.Hello()
  • self.Hello("World")
  • Hello()
  • Hello("World")
  • Hello();
  • Hello("World");


728x90
반응형