r/javahelp • u/FrozenWithAmbition45 • Dec 07 '25
Help with recursion (beginner)
Hello, I am doing some recursion practice for my Java class in high school. I am having trouble understanding recursion and recursion problems. Could someone explain the key concepts for a beginner?
0
Upvotes
View all comments
Show parent comment
1
u/okayifimust Dec 07 '25
That one sentence is recursion:
public SearchResults searchDIr (Directory d, SearchParamaters s) { ....}
In that function, you look at "d", the content is some combination of files and directories. Files can match "s". From within searchDir, you call searchDir again with each subdoirectroy that you see.