Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Could Someone Help Me With This Question?

Posted on 2004-03-21
3
Medium Priority
?
240 Views
Last Modified: 2010-03-31
class SampleClass {
   int a;
   int b;
   AnotherClass q;

   public void sampleMethod()
   {
         int c = 1;
         a = c * 7;
         b = 32 + c * a;
   }
}

which of the following statements is true?

        'c' is a reference.
        'a' and 'b' are local variables.
        'a' and 'b' are declared as a primitive data type.
        'q' is declared as a primitive data type.

Having a bit of trouble with this one.... thanks in advance!
0
Comment
Question by:Roxanne25
3 Comments
 
LVL 5

Accepted Solution

by:
twobitadder earned 500 total points
ID: 10644727
c. 'a' and 'b' are declared as a primitive data type.

primitive data types are int/long int/short int/char/boolean/float/double, (non-primitive can be any class composed of other classes and/or primitives - ie. a class is a non primitive data type).

-q isn't delcared as a primitive type because it is declared as a class.

-a and b are not local variables because they are declared outwith a method (local variables are declared inside a method and go out of scope after the method exits).

-depends on your definition of reference but c is declared as an int with the value one and so it holds '1' and does not refer to another object.
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 10645461
this looks like a question for the certification.
0
 

Author Comment

by:Roxanne25
ID: 10681596
Nope. :)  Was a homework question for a class.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question