your answer to the first question is correct.
what do they mean by variables exactly?
this tutorial page explains the exact meaning of variables.
the java programming language defines the following kinds of variables:
instance variables (non-static fields) technically speaking, objects store their individual states in "non-static fields", that is, fields declared without the static keyword. non-static fields are also known as instance variables because their values are unique to each instance of a class (to each object, in other words); the currentspeed of one bicycle is independent from the currentspeed of another.
class variables (static fields) a class variable is any field declared with the static modifier; this tells the compiler that there is exactly one copy of this variable in existence, regardless of how many times the class has been instantiated. a field defining the number of gears for a particular kind of bicycle could be marked as static since conceptually the same number of gears will apply to all instances. the code static int numgears = 6; would create such a static field. additionally, the keyword final could be added to indicate that the number of gears will never change.
local variables similar to how an object stores its state in fields, a method will often store its temporary state in local variables. the syntax for declaring a local variable is similar to declaring a field (for example, int count = 0;). there is no special keyword designating a variable as local; that determination comes entirely from the location in which the variable is declared — which is between the opening and closing braces of a method. as such, local variables are only visible to the methods in which they are declared; they are not accessible from the rest of the class.
parameters you've already seen examples of parameters, both in the bicycle class and in the main method of the "hello world!" application. recall that the signature for the main method is public static void main(string args). here, the args variable is the parameter to this method. the important thing to remember is that parameters are always classified as "variables" not "fields". this applies to other parameter-accepting constructs as well (such as constructors and exception handlers) that you'll learn about later in the tutorial.
in this case, the variables present are the instance fields
m (type 1 above). the object of type
n already defined in its class. since it extends
x, it inherits the class member field
m as well. a subclass inherits all of the public and protected members of its parent. therefore, the variables present in the object of type
y are members
the object y of type y contains two variables; an int "m" and an int "n" output: 3, 4
i would say:
the object y has a nested member, called n and a derived member from its super-class, called m.
- How do I know which variables exist in an object?
- How to know which version of ADT we are using in eclipse?
- Eclipse - How to know on which workspace I'm working without clicking/changing main view
- Java: How do I know which jar file to use given a class name?
- How do I know which Eclipse M2E connectors I have installed?
- How to setCurrentPage in ViewPager according to user selection & how do I know which list item called the activity
- In an AST Visitor, how can I know which node's property I am visiting?
- How do I know which version of RichFaces I am running?
- In Eclipse, how to know which parameter is the cursor on a Java Method?
- How can a function know which clickable textView has called it with onClick?
- How do I know the compiler version which the eclipse is using?
- How to know which jsp's were included in the final rendering of the page
- How do you change what the Eclipse debugger displays for an object in the Variables pane?
- How to know which jar file of android sdk contains the class I need
- How to know which line the app crashed?
- How do I know which project is requesting a specific jar from Maven
- How does the BufferedReader know which file to read?
- How to call an exist format function within eclipse for the code file which i created by my plugin?
- How do I know which method/class is called when I test java GUI in eclipse?
- How can I know which class is from interface
- How can I know in which IClasspathEntry an IJavaElement belongs to?
- How to find which classes implement a particular interface in Eclipse?
- Bold black cursor in Eclipse deletes code, and I don't know how to get rid of it
- Eclipse: The archive which is referenced by the classpath, does not exist
- Which emoji can be used as variables in Java, visible in Eclipse?
- How to know the command line used by Eclipse to run the java program?
- How to find out which feature contains a needed plug-in on an Eclipse download site
- How does eclipse know the name of your project?
- How to set environment variables to an application on OSX Mountain Lion?
- How to remove an entire line which matches a pattern
More Query from same tag
- Eclipse console terminates codes
- Unable to run identical servlet/hibernate project on my other pc
- Can't find e(fx)clipse plugin in Eclipse Marketplace
- Eclipse SVN Error : svn: E175002: Connection has been shutdown
- The method search() in the type "x" is not applicable for the arguments (String)
- TYCHO maven build is including two differents org.slf4j.api versions
- interactive debug console for Intellij and Eclipse like Pycharm has
- Which Eclipse version to install on Linux for PHP development
- SWTBot textWithLabel with more than two inputs
- Eclipse Luna dark theme doesn't show JS properly
- Using Kotlin to develope an Eclipse plugin
- Eclipse SWT ScrolledComposite refuses to scroll
- Include SVN tag in Javadoc - Eclipse
- Why eclipse need JAVA_HOME
- Eclipse Luna Android plugin sdk manager will not open.
- FileNotFound - When trying to get asset file
- Eclipse Error - Java was started but returned exit code=13
- How to run JUnit Eclipse Plugin tests with JMock?
- Eclipse will not Work?
- Narrow "Tasks" scope in Eclipse to single Path for TODOs, FIXMEs, etc
- DDMS (Android debug monitor) doesn't list processes on Galaxy S II
- Shake detection via service
- The archive: /common-entity/target/common-entity-1.0.0-SNAPSHOT.jar which is referenced by the classpath, does not exist
- while opening eclipse getting error
- upgrading of Birt to 4.3.2 --->org.eclipse.birt.report.exception.ViewerException: Fatal error occurred when try to startup report engine
- How do i configure Eclipse to have a tooltip for JSF?
- IBM Worklight 6.1 - Enable WL.Logger.debug in Worklight Development Server Console
- Getting exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element:
- Eclipse plugin : add jar to classpath when adding custom nature to a project
- DispatcherServlet.class Not Found