Question d’entretien chez PayPal

-Why in Java does it require "static" in the main function? -What's a static function? -Give me a SQL statement that returns the count of number of rows. -How do you sort by / group by?

Réponse à la question d'entretien

Utilisateur anonyme

5 févr. 2012

-Why in Java does it require "static" in the main function? The main method is static to give the Java VM interpreter a way to start the class without creating an instance of the control class first. Instances of the control class are created in the main method after the program starts. http://java.sun.com/developer/onlineTraining/Programming/BasicJava1/prog.html -What's a static function? It is a method which belongs to the class and not to the object(instance) A static method can access only static data. It can not access non-static data (instance variables) A static method can call only other static methods and can not call a non-static method from it. A static method can be accessed directly by the class name and doesn’t need any object Syntax : . A static method cannot refer to "this" or "super" keywords in anyway http://www.javatutorialhub.com/java-static-variable-methods.html -Give me a SQL statement that returns the count of number of rows. select count(*) from some_table -How do you sort by / group by? SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC http://www.w3schools.com/sql/sql_orderby.asp SELECT column_name, aggregate_function(column_name) FROM table_name WHERE column_name operator value GROUP BY column_name http://www.w3schools.com/sql/sql_groupby.asp