Methods and Strings Flashcards
methods declaration has two parts
method header, method body
method header defines …
name, parameters, return type
method body is the…
actual body of the method that defines its logic
final methods can be overridden ?
false
abstract must be?
must be overridden has an empty body in parent class but no in child classes
method overloading is
having more than one method with the same name but with different parameter types or different number of parameters
return type cannot be used to overload method ?
true
parameters in java are passed by value?
true
if the parameter is an object then what is passed? (value or reference)
it is the object reference is passed
this keyword references
to the object from which is called
main method
public static void main(String[] args)
why main method is public?
to be accessed from the outside
why static main method?
so no instantiation required
why string[] args ?
pass parameters to the program
when a object is eligible for garbage collection? it will be
deleted by garbage collector