Fichas
Sin título
Fichas del conjunto (59)
- 1What is used to compile a Java program?javac
- 2What is used to execute a Java program?java
- 3What is the extension for a Java source file?.java
- 4What is the file extension for a Java file after compiling?.class
- 5A java class consists of two things. What are they?1. Variables (Fields)
2. Methods - 6What are access modifiers?Modifiers that specify the level of access for classes, fields, and methods.
- 7There are four types of access modifiers. Name them.1. Default/nonspecified. No access modifier given by programmer.
2. Private
3. Public
4. Protected - 8What does the default access modifier do?Makes something visible to the package.
- 9What does the private access modifier do?Makes something visible only to the class.
- 10What does the public access modifier do?Makes something visible to the world.
- 11What does the protected access modifier do?Makes something visible to the package and all subclasses.
- 12What is the scope(visibility) of a protected access modifier?Any class within that same package and any subclass.
- 13What is a package in Java?A logical collection of classes.
- 14What does the file produced by Java compiler contain?Bytecodes
- 15What executes the programs compiled by the compiler?Java Virtual Machine (JVM)
- 16Bytecodes are platform independent or dependent?Independent
- 17How do objects communicate with one another?Through methods.
- 18What is information hiding?Declaring public methods and private fields(variables)
- 19What is a class?A reusable software component.
- 20How is an object of a class created?Through instantiation
- 21In instantiation, what method is called implicitly?Constructor
- 22What is the difference between an instance and a class variable?Class variable is shared by all instances; instance variable is not shared.
- 23Static variables are initialized....Only once at the beginning of execution, and before any of the instance variables are initialized.
- 24If a static variable is also declared as final...It can not be changed by any of the instances.
- 25A static variable can be accessed directly by the...and doesn't need any....Class name, object
- 26Give an example of accessing a static variable.ClassName.StaticVariableName
- 27What do static methods belong to?They belong to the class and not to individual instances
- 28A static method can only access what kind of variables?Static data(variables), but cannot access instanced variables.
- 29A static method can call what kinds of methods?A static method can call only other static methods - they cannot call a non-static method.
- 30How can a static method be accessed?Using the ClassName and doesn't need any object to be created.
- 31A static method cannot use what keyword?"this", which points to the current instance.
- 32Can a Static Method access a Static Variable?Yes
- 33Can a Static Method access an Instance Variable?No
- 34Can a Static Method call a static method?Yes
- 35Can a static method call an instance method?No
- 36Can an Instance(non-static) method access a static variable?Yes
- 37Can an Instance method access an Instance Variable?Yes
- 38Can an Instance method call a static method?Yes
- 39Can an Instance method call an instance method?Yes
- 40Can a static method change an instance variable?No
- 41Can an instance method change a static variable?Yes
- 42What two things must a parameter of a method specify?Type and Name
- 43Java provides what two primitive types for storing floating point numbers in memory?Float and Double
- 44What return type indicates that a method will not return a value?void
- 45Class String is in which package?java.lang
- 46Can the class String be extended?No
- 47What is the difference between a local variable and a field?A local variable is declared in the body of a method and can be used only from the point at which it's declared through the end of the method declaration. A field is declared in a class, but not in the body of any of the class's methods. Also, fields are accessible to all methods of the class.
- 48What is the default value for an integer (int)?0
- 49What is the default value for a String?null
- 50What is method overloading?Having several methods with the same name that each operate on different types or number of arguments.
- 51What is this an example of? Student5(int i, String n){ } Student5(int i, String n, int a){ }Method Overloading
- 52Method hypotenuse, which takes two double-precision, floating-point arguments side1 and side2 and returns a double, floating point result.double hypotenuse(double side1, double side2)
- 53Method smallest, which takes three integers x, y, and z, and then returns an integer.int smallest( int x, int y, int z)
- 54Method instructions, which does not take any arguments and does not return a value.void instructions()
- 55Method intToFloat, which takes integer argument number and returns a float.float intToFloat(int number)
- 56What operator is used to allocate memory to array variables in Java?new
- 57How do you specify in a method that you will allow a variable length parameters?methodName(type...varName)
- 58For strings: = is comparing what?Reference values, or where they are.
- 59For strings: .equals() compares what?Values of the strings. (Like Cabbage .equals("Cabbage"), but Cabbage (doesn't equal) .equals("MyCabbages!")
Información
- Descripción
- Fichas sobre Sin título, creado por kclark573 el 06/05/2015.
- Creado por
- kclark573
- Visitas
- 1
- Valoración