보통 Python으로 코딩하고 자바 학습을 시작했으나 인수로 메소드를 호출하는 것이 혼란 스럽습니다.인수를 사용하여 함수 호출하기
my_function(argument)
이처럼 만든 후에 :
def my_function(argument):
#Here I can use my argument like this
print(argument) #if argument is a string
을하지만 자바에서 같은 일을하는 방법을 발견하지 않았습니다 실제로 파이썬에서이 같은 인수로 함수를 호출 할 수 있습니다. 사실 나는 특히 이렇게 싶습니다
return new webPage() //this call my file named "webPage"
//But when I'm calling, I want to send the url of the
//web page and recover it in the other file
http://docs.oracle.com/javase/tutorial/java/javaOO/methods.html – exception1
return new webPage()에'new'를 삽입하여 무엇을 달성하고 싶습니까? –
새 개체를 만들 때 해당 클래스의 생성자를 호출하므로 인수를 사용하는 생성자를 만들어야합니다. – Martin