Skip to content

Instantly share code, notes, and snippets.

@DavidGinzberg
Last active November 9, 2016 18:26
Show Gist options
  • Save DavidGinzberg/608f5426747c51d26e54fc412b7da59b to your computer and use it in GitHub Desktop.
Save DavidGinzberg/608f5426747c51d26e54fc412b7da59b to your computer and use it in GitHub Desktop.

Interview Questions

General Knowledge

  • Can Java run on Windows? On mobile devices? On IoT Devices?
  • Is Java related to JavaScript? What are some ways they are similar or different

Vocabulary

  • What is an effectively final variable? Why is it significant?
  • How are Overriding and Overloading different? Can variables be overloaded? Can something be both overridden and overloaded?
  • What modifiers can be applied to local variables?
  • What does abstract mean when applied to a method? To a class?
  • What is the difference between an instance variable, a class variable, and a local variable?
  • Are primitives in java passed by reference, value, or both?
  • What does the instanceof keyword do?
  • What is the difference between extends and implements
  • What is the difference between throws and throw
  • What does the keyword final mean on a variable? A class? A method?
  • What is static?
  • What is a synthetic function?
  • What is javadoc?
  • What is aliasing? How does it work? Can you alias primitive types? Reference types?
  • What are the primitive types available in Java?
  • What is the difference between short and long?

Domain Knowledge

  • What is the difference between an abstract class and an interface?
  • What is an enum? Is an enum a class? How does it differ from other types of objects?
  • What is polymorphism? Is there a keyword to enable or disable polymorphism?
  • Do all methods that throw an exception have to declare that exception? Why or why not?
  • What is the difference between an Error and an Exception
  • Does a for loop have to have a code block after it?
  • What is the difference between a basic for statement and an enhanced for statement (aka: for each loop)?
  • In a for each loop on an ArrayList, what happens if you remove an element from the list?
  • What happens if you pass an object to System.out.println()? How can you change that behavior?
  • What is an inner class? Can inner classes have inner classes? How is a static inner class different from a non-static inner class?
  • What is an anonymous class? How do you create anonymous classes?

Code Analysis

  • Will this compile? What does it do?
class Demo{
void foo(){
if(aBoolean)
	System.out.println("aBoolean was True");
	aBoolean = false;
else
	System.out.println("aBoolean is False");
}
}
  • What does this code do?
int bar(int n){
	if( n == 1 || n == -1) return n;
	return bar( --n * -1 )
  • What is the difference between these two functions?
String strMaker1(String inStr){
  	return inStr.length() == 1 	? inStr 
								: strMaker1(inStr.substring(1,inStr.length())) + inStr.charAt(0);
}

String strMaker2(String inStr){
	return inStr.length() == 1 	? inStr 
								: inStr.charAt(0) + strMaker2(inStr.substring(1,inStr.length()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment