Computers Quiz

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Class Variable

Always defined in a class and not inside a method. * They are always static. * They can be either or public or private. * There is only one copy shared by every instance of the class. * If I have 7300 Cats then I will have one copy of numberOfLegs. * * The scope of class variables is the entire class. Class variables can be * used inside both static and non-static methods. * aka static variables

Instance Variable

Always defined inside a class and not inside a method. * They are never static. * They are usually private but they can be public. If you don't * specify by default they are public * There is one copy of this variable for every instance of the object!!!!! * If I have 7300 Cats then I need 7300 variables to store the name of the cat. * aka State aka non-static variable

Local Variable

They are always defined in a method or they are the input into a method. * String c is a local variable because it was declared inside a method * They are never static because this is ridiculous. * There is only one copy of a local variable that exists only while the method is executing * They never public or private - this is an absurd concept for a local variable. * * The scope of a local variable is the method where it is declared, although the scope * may be even more limited that. For example, if you declare a variable in the body of * an if statement its scope is that if statement.


Set pelajaran terkait

Physics Unit 3 Test: Forces (True/False)

View Set

Anatomy and Physiology 1 Chapter 8 and 9

View Set

Chapter 6: Values, Ethics, and Advocacy

View Set

OR Life and Health Insurance: Simulate Your Exam from Exam FX.

View Set

Algebra- Solving Inequalities Unit test Part 1

View Set

Key Questions: The Spread of Christian Ideas (10.3)

View Set