# there is no such data type thing that you have to declare in Python


# You may not see this line in programming.



"""

whatever I input between two set of three quotes, it would be not printed on screen. It is just ignored.

"""


"""

adfasfafdasdfasdfasdfasdfasdf

"""


# code after "#" would be ignored too

# asdfasdfasdfas

# asdfasdfasdfasdf

## asdfasdfasdfasdf


-------------

#Now let us expect what this programming code print out !

print(" We are learning Python ! ")

# print("We are having fun ! ")

"""

print("We would like to drink ")

"""

-------------

Q. What code above will print out ?

Answer : We are learning Python ! 


#Have a nice day everybody. (this is a single line comment)

"""

asdf

""" ( we call it multi-line comment)


'Study > Python' 카테고리의 다른 글

Hello World Python !  (0) 2018.10.06

[Java] Comment 주석 공부하기 ! 


There are two kinds of comment. One is single-line comment and other one is multi-line comment.

주석에는 두 가지 종류가 있습니다. 하나는 싱글라인 주석이고 다른 하나는 멀티라인 주석입니다.


1) Single - Line Comment ( 싱글라인 주석 ) 


// I am a single line comment

이런식으로 주석처리 하고 싶은 내용 앞에 // 슬래시 두개를 배치해놓으면 같은 줄에 위치한 슬래시 뒤 내용은 자바에서 무시합니다.

다른 예를 하나 더 들어보겠습니다.


EX] 

// I am a genius and you are suck !

String a = "Hi";

System.out.println(a);   //System.out.println("Hello");


이런식으로 코드를 하면 어떤 결과가 나올까요?

결과창에 Hi 라고만 나온다고 예상했다면 정답입니다. // 같은 줄에 위치하고 슬래시 두개 뒤에 있는 내용들은 무시되므로 #1 라인이랑 #3라인에 있는 두번째 System.out.println("Hello"); 는 무시될겁니다.



2) Multi - Line Comment ( 멀티라인 주석 )


멀티라인 주석은 " /* ", " */ " 슬래시 한개와 asterisk 별 한개를 시작 블락(Beginning Block) 이라고 합니다. Beginning Block과 Terminating Block 사이에 있는 내용은 라인에 위치와 상관 없이 모두 무시 됩니다.


EX]


public class Learn_to_Give{

public static void main(String[] args){

System.out.println("Learn to Give");

/* but I do not 

and everyone is not willing to learn to just give

so it might be a reason why people who learn to give are respected nowadays.

nevermind */ 

}

}

어떤 내용이 출력되고 어떤 내용이 주석처리되고 무시되는지 바로 확인이 가늠이 되시나요?

/**/ 사이에 있는 내용은 전부 주석처리 즉 코드에 있어서 무시됩니다.

주로 코드를 설명하거나, 메모가 필요할 때 프로그래머들이 자주 사용하곤 합니다. 하지만 따로 설명이 필요 없는 코드가 가장 이상적인 코드이겠지요.

자바 공부 화이팅 !

+ Recent posts