{"id":19827575,"url":"https://github.com/sandysanthosh/java-interview-programs-part1","last_synced_at":"2026-06-14T10:32:33.380Z","repository":{"id":107708940,"uuid":"122700737","full_name":"sandysanthosh/Java-Interview-Programs-Part1","owner":"sandysanthosh","description":"Java Interview Preparation","archived":false,"fork":false,"pushed_at":"2023-01-03T16:43:54.000Z","size":3414,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T20:57:49.316Z","etag":null,"topics":["interview","java"],"latest_commit_sha":null,"homepage":"https://github.com/TechBookHunter/Free-Coding-Interview-Books.git","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sandysanthosh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-24T03:48:03.000Z","updated_at":"2022-05-05T06:36:12.000Z","dependencies_parsed_at":"2023-06-08T20:00:13.975Z","dependency_job_id":null,"html_url":"https://github.com/sandysanthosh/Java-Interview-Programs-Part1","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sandysanthosh/Java-Interview-Programs-Part1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FJava-Interview-Programs-Part1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FJava-Interview-Programs-Part1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FJava-Interview-Programs-Part1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FJava-Interview-Programs-Part1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandysanthosh","download_url":"https://codeload.github.com/sandysanthosh/Java-Interview-Programs-Part1/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandysanthosh%2FJava-Interview-Programs-Part1/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34318523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["interview","java"],"created_at":"2024-11-12T11:13:39.512Z","updated_at":"2026-06-14T10:32:33.375Z","avatar_url":"https://github.com/sandysanthosh.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Java-Interview-Programs\n\n\n#### Java Interview Preparation\n\n\n 1 . Why is Java so popular?\n\n 2 . What is platform independence?\n\n 3 . What is bytecode?\n\n 4 . Compare JDK vs JVM vs JRE \n\n 5.  What are the important differences between C++ and Java?\n\n 6 . What is the role for a classloader in Java? Wrapper Classes\n\n 7 . What are Wrapper classes? \n\n 8 . Why do we need Wrapper classes in Java? \n \n 9 . What are the different ways of creating Wrapper class instances?\n\n 10 . What are differences in the two ways of creating Wrapper classes?\n\n 11 . What is auto boxing?\n\n 12 . What are the advantages of auto boxing?\n\n 13 . What is casting?\n\n 14 . What is implicit casting?\n\n 15 . What is explicit casting?\n\n #### Strings:\n\n 16 . Are all String’s immutable?\n\n 17 . Where are String values stored in memory?\n\n 18 . Why should you be careful about String concatenation(+) operator in loops?\n\n 19 . How do you solve above problem?\n\n 20 . What are differences between String and StringBuffer?\n\n 21 . What are differences between StringBuilder and StringBuffer?\n\n 22 . Can you give examples of different utility methods in String class?\n\n#### Object oriented programming basics\n\n 23 . What is a class?\n\n 24 . What is an object?\n\n 25 . What is state of an object? \n\n 26 . What is behavior of an object?\n\n 27 . What is the super class of every class in Java?\n\n 28 . Explain about toString method ?\n\n 29 . What is the use of equals method in Java?\n\n 30 . What are the important things to consider when implementing equals method?\n\n 31 . What is the Hashcode method used for in Java?\n\n 32 . Explain inheritance with examples\n\n 33 . What is method overloading?\n\n 34 . What is method overriding?\n\n 35 . Can super class reference variable can hold an object of sub class?\n\n 36 . Is multiple inheritance allowed in Java?\n\n 37 . What is an interface?\n \n 38 . How do you define an interface?\n\n 39 . How do you implement an interface?\n\n 40 . Can you explain a few tricky things about interfaces?\n\n 41 . Can you extend an interface?\n\n 42 . Can a class extend multiple interfaces?\n\n 43 . What is an abstract class?\n\n 44 . When do you use an abstract class?\n\n 45 . How do you define an abstract method?\n\n 46 . Compare abstract class vs interface?\n\n 47 . What is a constructor?\n\n 48 . What is a default constructor?\n\n 49 . Will this code compile?\n\n 50 . How do you call a super class constructor from a constructor?\n\n 51 . Will this code compile?\n\n 52 . What is the use of this()?\n\n 53 . Can a constructor be called directly from a method?\n\n 54 . Is a super class constructor called even when there is no explicit call from a sub class constructor? \n\n\n #### Advanced object oriented concepts\n\n 55 . What is polymorphism?\n\n 56 . What is the use of instanceof operator in Java?\n\n 57 . What is coupling?\n\n 58 . What is cohesion?\n\n 59 . What is encapsulation?\n\n 60 . What is an inner class?\n\n 61 . What is a static inner class?\n\n 62 . Can you create an inner class inside a method?\n\n 63 . What is an anonymous class?\n\n#### Modifiers \n\n 64 . What is default class modifier? \n\n 65 . What is private access modifier? \n \n 66 . What is default or package access modifier?\n\n 67 . What is protected access modifier?\n\n 68 . What is public access modifier?\n\n 69 . What access types of variables can be accessed from a class in same package? \n\n70 . What access types of variables can be accessed from a class in different package? \n\n71 . What access types of variables can be accessed from a sub class in same package? \n\n72 . What access types of variables can be accessed from a sub class in different package? \n\n73 . What is the use of a final modifier on a class?\n\n74 . What is the use of a final modifier on a method? \n\n75 . What is a final variable? \n\n76 . What is a final argument? \n\n77 . What happens when a variable is marked as volatile? \n\n78 . What is a static variable? conditions \u0026 loops\n\n79 . Why should you always use blocks around if statement?\n\n80 . Guess the output\n\n81 . Guess the output\n\n82 . Guess the output of this switch block \n\n83 . Guess the output of this switch block?\n\n84 . Should default be the last case in a switch statement?\n\n85 . Can a switch statement be used around a String\n\n86 . Guess the output of this for loop\n\n87 . What is an enhanced for loop?\n\n88 . What is the output of the for loop below?\n\n89 . What is the output of the program below?\n\n90 . What is the output of the program below?\n\n#### Exception handling \n\n91 . Why is exception handling important? \n\n92 . What design pattern is used to implement exception handling features in most languages?\n\n93 . What is the need for finally block?\n\n94 . In what scenarios is code in finally not executed?\n\n95 . Will finally be executed in the program below?\n\n96 . Is try without a catch is allowed?\n\n97 . Is try without catch and finally allowed?\n\n98 . Can you explain the hierarchy of exception handling classes?\n\n99 . What is the difference between error and exception?\n\n100 . What is the difference between checked exceptions and unchecked exceptions? \n\n101 . How do you throw an exception from a method? \n\n102 . What happens when you throw a checked exception from a method? \n\n103 . What are the options you have to eliminate compilation errors when handling checked exceptions? \n\n104 . How do you create a custom exception? \n\n105 . How do you handle multiple exception types with same exception handling block? \n\n106 . Can you explain about try with resources? \n\n107 . How does try with resources work? \n\n108 . Can you explain a few exception handling best practices?\n\n#### Miscellaneous topics \n\n109 . What are the default values in an array? \n\n110 . How do you loop around an array using enhanced for loop? \n\n111 . How do you print the content of an array?\n\n112 . How do you compare two arrays? \n\n113 . What is an enum? \n\n114 . Can you use a switch statement around an enum? \n\n115 . What are variable arguments or varargs? \n\n116 . What are asserts used for? \n\n117 . When should asserts be used? \n\n118 . What is garbage collection? \n\n119 . Can you explain garbage collection with an example? \n\n120 . When is garbage collection run? \n\n121 . What are best practices on garbage collection? \n\n122 . What are initialization blocks?\n\n123 . What is a static initializer? \n\n124 . What is an instance initializer block? \n\n125 . What is tokenizing? \n\n126 . Can you give an example of tokenizing?\n\n127 . What is serialization? \n\n128 . How do you serialize an object using serializable interface? \n\n129 . How do you de-serialize in Java? \n\n130 . What do you do if only parts of the object have to be serialized? \n\n131 . How do you serialize a hierarchy of objects? \n\n132 . Are the constructors in an object invoked when it is de-serialized? \n\n133 . Are the values of static variables stored when an object is serialized? Collections \n\n134 . Why do we need collections in Java?\n\n135 . What are the important interfaces in the collection hierarchy? \n\n136 . What are the important methods that are declared in the collection interface? \n\n137 . Can you explain briefly about the List interface? \n\n138 . Explain about ArrayList with an example? \n\n139 . Can an ArrayList have duplicate elements? \n\n140 . How do you iterate around an ArrayList using iterator? \n\n141 . How do you sort an ArrayList? \n\n142 . How do you sort elements in an ArrayList using comparable interface? \n\n143 . How do you sort elements in an ArrayList using comparator interface? \n\n144 . What is vector class? How is it different from an ArrayList? \n\n145 . What is linkedList? What interfaces does it implement? How is it different from an ArrayList?\n\n146 . Can you briefly explain about the Set interface? \n\n147 . What are the important interfaces related to the Set interface? \n\n148 . What is the difference between Set and sortedSet interfaces? \n\n149 . Can you give examples of classes that implement the Set interface? \n\n150 . What is a HashSet? \n\n151 . What is a linkedHashSet? How is different from a HashSet? \n\n152 . What is a TreeSet? How is different from a HashSet? \n\n153 . Can you give examples of implementations of navigableSet? \n\n154 . Explain briefly about Queue interface? \n\n155 . What are the important interfaces related to the Queue interface? \n\n156 . Explain about the Deque interface? \n\n157 . Explain the BlockingQueue interface? \n\n158 . What is a priorityQueue? \n\n159 . Can you give example implementations of the BlockingQueue interface? \n\n160 . Can you briefly explain about the Map interface? \n\n161 . What is difference between Map and sortedMap? \n\n162 . What is a HashMap? \n\n163 . What are the different methods in a Hash Map? \n\n164 . What is a TreeMap? How is different from a HashMap? \n\n165 . Can you give an example of implementation of navigableMap interface? \n\n166 . What are the static methods present in the collections class? \n\n#### Advanced collections:\n\n167 . What is the difference between synchronized and concurrent collections in Java? \n\n168 . Explain about the new concurrent collections in Java? \n\n169 . Explain about copyonwrite concurrent collections approach? \n\n170 . What is compareandswap approach? \n\n171 . What is a lock? How is it different from using synchronized approach? \n\n172 . What is initial capacity of a Java collection? \n\n173 . What is load factor? \n\n174 . When does a Java collection throw UnsupportedOperationException? \n\n175 . What is difference between fail-safe and fail-fast iterators? \n\n176 . What are atomic operations in Java? \n\n177 . What is BlockingQueue in Java? \n\n#### Generics: \n\n178 . What are Generics? \n\n179 . Why do we need Generics? Can you give an example of how Generics make a program more flexible? \n\n180 . How do you declare a generic class? \n\n181 . What are the restrictions in using generic type that is declared in a class declaration? \n\n182 . How can we restrict Generics to a subclass of particular class? \n\n183 . How can we restrict Generics to a super class of particular class? \n\n184 . Can you give an example of a generic method? Multi threading \n\n185 . What is the need for threads in Java? \n\n186 . How do you create a thread? \n\n187 . How do you create a thread by extending thread class? \n\n188 . How do you create a thread by implementing runnable interface? \n\n189 . How do you run a thread in Java? \n\n190 . What are the different states of a thread? \n\n191 . What is priority of a thread? How do you change the priority of a thread? \n\n192 . What is executorservice? \n\n193 . Can you give an example for executorservice? \n\n194 . Explain different ways of creating executor services . \n\n195 . How do you check whether an executionservice task executed successfully? \n\n196 . What is callable? How do you execute a callable from executionservice? \n\n197 . What is synchronization of threads? \n\n198 . Can you give an example of a synchronized block? \n\n199 . Can a static method be synchronized? \n\n200 . What is the use of join method in threads? \n\n201 . Describe a few other important methods in threads? \n\n202 . What is a deadlock? \n\n203 . What are the important methods in Java for inter-thread communication? \n\n204 . What is the use of wait method? \n\n205 . What is the use of notify method?\n\n206 . What is the use of notifyall method? \n\n207 . Can you write a synchronized program with wait and notify methods? Functional Programming - Lamdba expressions and Streams \n\n208 . What is functional programming?\n\n209 . Can you give an example of functional programming? \n\n210 . What is a stream?\n\n211 . Explain about streams with an example? what are intermediate operations in streams? \n\n212 . What are terminal operations in streams? \n\n213 . What are method references? \n\n214 . What are lambda expressions?\n\n215 . Can you give an example of lambda expression? \n\n216 . Can you explain the relationship between lambda expression and functional interfaces?\n\n217 . What is a predicate?\n\n218 . What is the functional interface - function? \n\n219 . What is a consumer? \n\n220 . Can you give examples of functional interfaces with multiple arguments?\n\n#### New Features \n\n221 . What are the new features in Java 5?\n\n222 . What are the new features in Java 6? \n\n223 . What are the new features in Java 7? \n\n224 . What are the new features in Java 8?\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandysanthosh%2Fjava-interview-programs-part1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandysanthosh%2Fjava-interview-programs-part1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandysanthosh%2Fjava-interview-programs-part1/lists"}