This repository contains small Java exercises and utilities (single-file programs). Each source file is located in a folder that reflects how you organized practice problems.
Files
Family cousin/BFS.java: declarespackage Exam; provides aBFSclass with amainmethod. Implements level-order traversal and a cousin-finding helper. Run with package-qualified name (see commands below).Password Checker/PasswordChecker.java: default package; containsPasswordCheckerwithmainthat generates case permutations for a sample string.Brand Logo Name/Brand_Logo.java: default package; containsBrand_Logowith amainthat prints a computed char result.Brand Logo Name/Brand_Logo_Name.java: default package (nomain); providescompanyLogoutility method for the Brand Logo problem.
Quick compile & run (Windows PowerShell)
- For files that declare a package (example:
BFS.javadeclarespackage Exam;) compile into package folders and run using the package-qualified class name:
javac -d . "Family cousin\BFS.java"
java Exam.BFS- For files in the default package (no
packageline) you can compile and run from the workspace root. Because some directories contain spaces, wrap paths in quotes.
Example (compile+run PasswordChecker):
javac "Password Checker\PasswordChecker.java"
java -cp "Password Checker" PasswordCheckerExample (compile+run Brand_Logo):
javac "Brand Logo Name\Brand_Logo.java"
java -cp "Brand Logo Name" Brand_LogoNotes
- Keep
packagedeclarations and filesystem layout consistent: if a source file declarespackage Exam;the compiled.classmust be placed under anExamdirectory (thejavac -d .approach does this). - If you prefer running classes without package qualifiers, remove the
packageline from the source (not recommended for larger projects).