# Java Questions and Problems ## Java Standard Edition (Java SE) Questions * The String class is immutable. What does this mean and what are the implications in multi-threaded programming? * Why must you write `s = s.trim();` and not simply `s.trim();`? * What are the sizes (in bits) of the following six primitive types: byte, short, int, long, float, double, and char? * Discuss various design patterns you have used. What works for you? * Describe the Model-View-Controller pattern (or the related Observer/Observable pattern). * What IDE (Integrated Development Environment) do you use? * Discuss configuration management systems (SVN, GIT) and build management systems (Ant, Maven). Which have you used? * What are some ways that you can access a database from your Java code? Discuss Object-Relational Mapping (ORM). * Who wrote this code?
    public boolean question() {  
        return bb || !bb;  
    }
* Given an XML schema, how would you create Java object mappings? * Does Java have multiple (implementation) inheritance? ---- ## Java Enterprise Edition (Java EE) Questions * What does a JavaServer Page (JSP) become inside the web application container (i.e., to what is it converted)? * HTTP is a stateless protocol. Explain this. How do servlets maintain state? * What is the difference between a Stateless Session Bean and an Entity Bean? What are the use cases for each? * Describe the session facade pattern. * Discuss some Java EE frameworks that you or your organization have used. ---- Prior to the interview process, you may be asked to solve a programming problem. The following are some sample problems that are interesting from a programming perspective as they cover not just Java programming, but algorithms, recursion, error handling, input processing, and output formatting. You need not be interviewed to try your hand at these. We welcome ad hoc submissions as well. Have fun! ---- ## Fibonacci Series (Coding Problem) In the 12th century, Leonardo Fibonacci discovered a simple numerical series. Starting with 0 and 1, each new number in the series is simply the sum of the two before it. > 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, . . . ### Problem Write a class (`Fib.java`) containing a `main` method that, when invoked with a single numeric argument *n*, prints the first *n* Fibonacci numbers. For example, running java Fib 10 would print the following: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 The following table gives the output for varying values of *n*.
Input (n) Output (System.out)
0 nothing is printed
1 0
2 0, 1
3 0, 1, 1
10 0, 1, 1, 2, 3, 5, 8, 13, 21, 34
### Requirements The following are the minimum requirements: * Your program must check for the correct number of arguments (i.e., one). * Your program must check for the correct input range (i.e., non-negative input). * Your program must print the output in the manner described above (i.e., a comma-space delimited output with no trailing punctuation). * Your program must correctly handle the two base cases (0 and 1) as described in the table above. Please be prepared to discuss your approach in terms of general efficiency, use of stack space, and overall approach to error handling. Also, we kindly ask that you make this be your own work. We have reviewed most of the samples publically available and would prefer that this is an original creation. Submit your class to [resumes@lynxbridge.com](mailto:resumes@lynxbridge.com) with a subject line of `Fibonacci`.