100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4,6 TrustPilot
logo-home
Resumen

Summary Character and strings sum

Puntuación
-
Vendido
-
Páginas
6
Subido en
19-02-2025
Escrito en
2024/2025

Making Java easier for IEB students

Institución
Grado









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Grado
Schooljaar
200

Información del documento

Subido en
19 de febrero de 2025
Número de páginas
6
Escrito en
2024/2025
Tipo
Resumen

Temas

Vista previa del contenido

ddStatic vs Non-static Methods:


What is a Non-Static Method?
• A non-static method is a method that we say “belongs to
the object”
• When you instantiate (create) a new object, a chunk of RAM
gets reserved and copies of all the parent methods (and
fields) are written into that space.
• Each object has inherited its own set of methods (this is one
of the foundations of OOP)
• The Gogga object has its own copy of move(), setDirection(),
etc
• ALL of these inherited methods are non-static methods
• You call a non-static method by using the object name
(Gogga bob = new Gogga();
bob.setPosition(5,7);)
What is a Static Method?
• A method that is “global” it is common to all objects.
• Not every object can inherit its own copy of such a method.
• Single instance of this method is held instead by the class
• Static method “belongs” to the class
• ALL the Gogga object that we create sit on the same grid
• setGridSize() method is static because ALL Goggas use the
same Grid
• You call static methods by calling their class name and also
the String class (char upperChar =
Character.to.UperCase(‘a’);)
How Does this Idea Extend to Fields?
• Fields (and even classes) can also be static or non-static
• A class called Dog(), that will create new instances of dog
objects each time it is invoked(run/executed)

, • numberOfLegs field is ALWAYS going to be 4. So, there is
no need for every dogs to have it’s own copy of this field
• It is better for Class Dog() to have single, static field, that
the individual objects would then just reference if needed
• But hairColour would be non-static field, because dogs have
a wide variety of different colours. So, each object would
need its own copy of this field
• Non-static field, or fields that belong to an instance of a
class (an object), are also sometimes known as “instance
variables”


Method Declarations, Headers and Signatures:
What is a Method Declaration?
• The method declaration is the whole bang-shoot, The
entire method.
What is a Method Header?
• The first line of the method declaration.
What is the Method Signature?
• The method name and any parameters.
Related Terminology:
• public: is the access modifier
• static: specifies if the method belongs to the class, or
object of the class
• void/othertypes: this is the types of data that the
method returns


Characters have value:
$7.45
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor
Seller avatar
sangeengxonono

Conoce al vendedor

Seller avatar
sangeengxonono
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
0
Miembro desde
11 meses
Número de seguidores
0
Documentos
1
Última venta
-

0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes