인프런 커뮤니티 질문&답변
왜 DeleteNodes() 만 static method 인가요?
작성
·
311
0
static method는 인스턴스 없이 클래스 이름만으로도 메서드를 부를 수 있게 해주는 걸로 알고 있는데, DeleteNodes()를 그런 식으로 사용할 이유는 없어 보여서 의도가 궁금합니다!
퀴즈
What is the main cause of unexpected results that can occur when multiple threads simultaneously access and modify shared data in a multithreading environment?
Deadlock
Thread Local Storage (TLS) conflict
Race Condition
CPU Pipeline Failure
답변 1
0
Rookiss
지식공유자
현재 stack 객체와 상관이 없이 실행될 수 있는
함수이기 때문에 static으로 빼놓은 것이지만
그 정도로 디테일하게 분석할 필요는 없습니다.
non-static으로 만들어서 stack객체.DeleteNodes(node); 로 호출한다고 딱히 다른 것은 아니고
알고리즘이 중요한 것이지 저런 세부적인 부분은 넘어가셔도 됩니다.





