Get Started
Interview Coach 1:1
Gain the confidence you need by asking our professionals any interview scenario, question, or answer you are unsure about.
Let Us Review Your Answers
Our interviewing professionals will gladly review and revise any answer you send us. Allowing you to craft perfect responses for your next job interview.
Interview Questions by Topic
Interview Questions by Career
Interview Questions by Company

Facebook Java Developer
Interview Questions

20 Questions and Answers by
| William Swansen is an author, job search strategist and career advisor who assists individuals from all over the world.

Question 1 of 20

Can you define the final keyword in Java?

1000s of Interview Questions

Win your next job by practicing from our question bank. We have thousands of questions and answers created by interview experts.

Java Developer Interview Questions

  1. 1.

    Can you define the final keyword in Java?

      This technical question asks you to define a concept within Java. When interviewing at Facebook or any other organizaiton, you should carefully listen to the questions you are being asked. Do not start to formulate your answer until the interviewer has completed asking the question. This will ensure that you understand what they are asking and that your answer corresponds to what they are looking for. When answering this question, the mistake you can make is providing too much information since you are only being asked to define the concept.

      William's Answer

      "Within Java, the final keyword is used with the class to make sure that no other class can extend it."

  2. 2.

    In your opinion, Is Java Pass By Value or Pass By Reference?

      You may note that this question asks you for your opinion, even though it is technical. Not all technical questions have finite answers. Some may be relevant to the work you do or the type of experience you have writing programs. It is okay to state an opinion about a topic as long as you can support your answer. When asked a question of this type during the interview with Facebook, you can anticipate follow-up questions asking why you believe this to be the right answer.

      William's Answer

      "This is an interesting question. If you ask the current Java developers working here at Facebook, some will say that Java is pass by value, while the others will say pass by reference. In my opinion, Java is pass by value. This is how it is defined in the Java Spec. Java method parameters directly associate variable passing and method calling. The exception is when we pass a reference of complex types defined as method parameters, the memory address is copied to a new reference variable."

  3. 3.

    Can you tell me what a Compare and Swap algorithm is and how you use it when coding in Java?

      This is a more complex technical question, which asks you to define a term and then discuss how it is used when creating a Java program. Regardless of whether a question is simple or complex, it would be best to keep your answer brief and to the point. The Facebook interviewer will either ask for more information or move on to the next topic.

      William's Answer

      "Compare and Swap is a type of instruction which helps to synchronize threads in a multi-threading environment. The way it works is to examine the content of a memory location and, if it matches another location, it modifies the value of the content and creates a new value. This prevents the content from being used by another thread and a write operation failing."

  4. 4.

    When programming in Java, can you have an empty catch block?

      This is an example of an operational question. Operational questions evaluate specific elements used in your job. Like technical questions, answers to operational questions should be brief and to the point. You should also anticipate follow-up questions if the Facebook interviewer needs additional information or wants to explore the topic in more detail.

      William's Answer

      "While you can use an empty catch block while programming in Java, it is not advised. The problem this creates involves debugging the program if the empty catch block were to catch an exception. There will not be any information about the exception. Finding the issue with no information in the log could be very time-consuming."

  5. 5.

    Since many Facebook applications are developed using Java. can you tell me what the key elements of the Java programming language are ?

      This is the type of question an interviewer at Facebook will use to begin the conversation, learn more about your background, and collect information they can use throughout the interview. This question also provides you the opportunity to direct the interview towards a subject area that you are familiar with and comfortable responding to questions about. Throughout the interview, keep your answers brief and to the point. This will encourage the interviewer to ask follow-up questions about the same topic or move on to a new subject.

      William's Answer

      "There are several key features of the Java programming language. First, it is simple to learn. Next, Java is somewhat object-oriented and enables programmers to manage their code using objects. Several other key features of Java include its portability, platform independence, security, and the large library of code available to programmers."

  6. 6.

    Within Java, what are the differences between Path and Classpath variables?

      This is a common format of a technical question. Technical questions ask you about concepts or items related to the work you do. They sometimes ask you to compare similar concepts or to describe how they are used. When answering technical questions using this format, you should first define the terms you were asked about. You then either compare them or describe how they are used. You may provide an example relevant to the Facebook job posting if it helps illustrate your answer.

      William's Answer

      "Both Path and Classpath are environmental variables which the operating system uses to locate executables. The OS locates the executables in a directory location, which is defined by these variables. The difference between a Path and Classpath variable is that a classpath is very specific to Java and can be defined as a directory, ZIP file, JAR file or another type of variable. This is critical since you need to select the appropriate Path based on what Facebook API you want to use."

  7. 7.

    Can you discuss the importance of the main() method in Java?

      This is another example of a technical question. As a Java developer who is interviewing with Facebook, you can anticipate that most of the questions you will be asked during an interview will be technical. The best way to prepare for these is to review the concepts used in Java programming and understand the processes, libraries, tools, and methodologies Java developers use. Being familiar with these will help you prepare for the questions you are likely to be asked.

      William's Answer

      "The main() method as it is used in Java provides programmers with an entry point for any code they are writing. It defines the syntax to run a program within the Java language. It also enables Java to access the code without initializing a class. The value contained within the parentheses is an array of string related to runtime arguments."

  8. 8.

    How is Enum used in Java?

      You should already recognize this as a technical question. It is asking you how a concept or process is used within the Java programming language. Continue to answer technical questions directly and briefly, with little embellishment, anticipating follow-up questions from the Facebook interviewer.

      William's Answer

      "Enum is a type whose field is made up of fixed sets of constants. An example of this would be the setting of times within a Java program used in Facebook as morning, noon, afternoon, and evening. These become key words used to create enum types, which are similar to a class."

  9. 9.

    How is a volatile keyword used in Java?

      This technical question assumes you know the definition of the term the Facebook interviewer is asking about and only requests that you describe how it is used. By carefully listening to the interview's questions, you will provide the answer they are expecting. If you begin to think about your answer while the interviewer is still talking, you may miss the question's essence and give an answer which is not related to the question.

      William's Answer

      "A volatile keyword is used in Java with variable and threads which read its value directly from its memory location. This ensures the value is read exactly as it is contained in the memory location, and that the threads or variables do not cache it in case it changes. Since Facebook is heavily dependent on the use of keywords, this concept is important to know."

  10. 10.

    Can you discuss what a static import is and what the pitfalls of using this are?

      This technical question asks you to first define the concept and then describe some features of its use. This is a common format for technical questions that a Facebook interviewer will ask you. When answering a question during an interview, you should anticipate follow-up questions. These indicate that the interviewer needs additional information or has a strong interest in the topic they are asking about. It may also be an indicator that the topic is important to the operations of the organization.

      William's Answer

      "Static import is the process of importing the class and the method variable with the class name from another class. This makes the class available. The pitfall of using this methodology is that it may cause confusion if it is overused and thereby trigger the program to malfunction. While I've never encountered this when using Facebook or some of the applications developed for it, I have seen the problem occur in other applications."

  11. 11.

    Facebook developers usually write their programs using Java. Can you describe how access modifiers are used in Java?

      Technical questions asked in this fashion are requesting that you describe how a concept or process is used when programming in Java. When answering this type of question, you may want a skip defining the concept and simply state how it is used. You can still provide an example if this helps clarify your answer. Make sure to keep your answer brief and to the point. The Facebook interviewer will ask a follow-up question if they need additional information.

      William's Answer

      "Access modifiers are used to establish accessibility to classes, methods, and other members when writing code in the Java programming language. The four types of access modifiers are default, public, private, and protected. These define how the classes, methods and members can be accessed."

  12. 12.

    What is Composition, as used in Java?

      As the interview with Facebook progresses, the hiring manager will continue to ask you technical questions about writing programs within Java. Some of these will be very simple, asking you to define basic concepts that any programmer should know. Others will be more complex and require you to give longer, more complicated answers to define the concept, describe how it is used, and give an example of how to write the code. The best way to prepare for these is the practice these types of questions, stating the answers out loud, so you become comfortable doing this.

      William's Answer

      "Composition is a method used in Java to implement has-a relationships within classes. This facilitates code reuse through object composition. When using composition, you implement instance variables that refer to different objects. The benefit is to provide visibility of the objects to other classes so they can reuse them."

  13. 13.

    Tell me about the Java Reflection API?

      As the interview progresses, the technical questions will become more difficult. This indicates that the Facebook interviewer is gaining confidence in your qualifications and is willing to explore your background in more depth. Continue to answer the questions, in the same manner, keeping your answers brief and to the point. While interviewing with Facebook for a Java Developer's position, you will be asked many questions about APIs, such as SOAP API or REST API. Make sure you review these so you'll be prepared to answer the questions.

      William's Answer

      "The Java Reflection API enables you to test and modify applications while they are running. You can inspect the various elements of the java programming language, seeing the details. Java developers use this to debug and improve their programming."

  14. 14.

    What is a marker interface, and how do you use it when writing Java code for the Facebook environment?

      The fact that this is a technical question is obvious since it asks you to define a term and then discuss how it is used. Make sure you answer each part of the question in the order asked. This will help the interviewer follow your answer and confirm that you are listening to their questions during the interview.

      William's Answer

      "A marker interface, as it is used in Java, is a design pattern which provides runtime information about the objects within the program. It also enables the addition of metadata with a class even though the Java language doesn't implicitly support metadata. When coding in Java, the marker interface is used as an interface which doesn't specify a method."

  15. 15.

    Can you discuss the differences between a user and a daemon thread?

      A common format of technical questions you will be asked during an interview with Facebook is asking you to compare two terms. The best way to respond to these types of questions is to first define the terms, and then compare the differences or similarities. You may even want to provide an example to help illustrate your answer.

      William's Answer

      "The differences between a user thread and a daemon thread are how they are created, and their impact on JVM. User threads are created by programmers, while daemon threads run in the background. If a user thread is present, the JVM will not shut down, and the program will continue to run. However, the presence of a daemon thread does not prevent the JVM from terminating."

  16. 16.

    Talk about what a Java timer class is and how you schedule a task to run after a specific interval?

      View All 20 Facebook Answers
      Sign up to access our library of 50,000+ Answers,
      plus coaches for one-on-one support, so you can interview more confidently.
  17. 17.

    Please define a CountDownLatch in the context of Java?

      View All 20 Facebook Answers
      Sign up to access our library of 50,000+ Answers,
      plus coaches for one-on-one support, so you can interview more confidently.
  18. 18.

    How does an OutOfMemoryError impact a program written in Java, and how can this be corrected?

      View All 20 Facebook Answers
      Sign up to access our library of 50,000+ Answers,
      plus coaches for one-on-one support, so you can interview more confidently.
  19. 19.

    Please describe the JDBC API and discuss how it is used?

      View All 20 Facebook Answers
      Sign up to access our library of 50,000+ Answers,
      plus coaches for one-on-one support, so you can interview more confidently.
  20. 20.

    What are some examples of JDBC drivers you would use when programming applications for Facebook?

      View All 20 Facebook Answers
      Sign up to access our library of 50,000+ Answers,
      plus coaches for one-on-one support, so you can interview more confidently.