<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'what would be the output?' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'what would be the output?' posted on the 'Java' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 25 May 2013 19:06:52 -0700</pubDate>
    <lastBuildDate>Sat, 25 May 2013 19:06:52 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>what would be the output?</title>
      <link>http://www.programmersheaven.com/mb/java/315196/315196/what-would-be-the-output/</link>
      <description>Consider the following class: &lt;br /&gt;
public class IdentifyMyParts {&lt;br /&gt;
    public static int x = 7; &lt;br /&gt;
    public int y = 3; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
a. How many class variables does the IdentifyMyParts class contain? What are their names? &lt;br /&gt;
b. How many instance variables does the IdentifyMyParts class contain? What are their names? &lt;br /&gt;
&lt;br /&gt;
c. What is the output from the following code: &lt;br /&gt;
&lt;br /&gt;
IdentifyMyParts a = new IdentifyMyParts();&lt;br /&gt;
IdentifyMyParts b = new IdentifyMyParts();&lt;br /&gt;
a.y = 5;&lt;br /&gt;
b.y = 6;&lt;br /&gt;
a.x = 1;&lt;br /&gt;
b.x = 2;&lt;br /&gt;
System.out.println("a.y = " + a.y);&lt;br /&gt;
System.out.println("b.y = " + b.y);&lt;br /&gt;
System.out.println("a.x = " + a.x);&lt;br /&gt;
System.out.println("b.x = " + b.x);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java/315196/315196/what-would-be-the-output/</guid>
      <pubDate>Wed, 14 Sep 2005 07:28:10 -0700</pubDate>
      <category>Java</category>
    </item>
    <item>
      <title>Re: what would be the output?</title>
      <link>http://www.programmersheaven.com/mb/java/315196/315223/re-what-would-be-the-output/#315223</link>
      <description>&lt;strong&gt;&lt;span style="color: Red;"&gt;This message was edited by Vilanye at  2005-9-14 10:0:14&lt;/span&gt;&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;
: Consider the following class: &lt;br /&gt;
: public class IdentifyMyParts {&lt;br /&gt;
:     public static int x = 7; &lt;br /&gt;
:     public int y = 3; &lt;br /&gt;
: }&lt;br /&gt;
: &lt;br /&gt;
: a. How many class variables does the IdentifyMyParts class contain? What are their names? &lt;br /&gt;
: b. How many instance variables does the IdentifyMyParts class contain? What are their names? &lt;br /&gt;
: &lt;br /&gt;
: c. What is the output from the following code: &lt;br /&gt;
: &lt;br /&gt;
: IdentifyMyParts a = new IdentifyMyParts();&lt;br /&gt;
: IdentifyMyParts b = new IdentifyMyParts();&lt;br /&gt;
: a.y = 5;&lt;br /&gt;
: b.y = 6;&lt;br /&gt;
: a.x = 1;&lt;br /&gt;
: b.x = 2;&lt;br /&gt;
: System.out.println("a.y = " + a.y);&lt;br /&gt;
: System.out.println("b.y = " + b.y);&lt;br /&gt;
: System.out.println("a.x = " + a.x);&lt;br /&gt;
: System.out.println("b.x = " + b.x);&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
a) You can't count? Should be pretty straightforward.&lt;br /&gt;
&lt;br /&gt;
b) Find out what an instance variable is. Basically what is the difference between a static variable and a non-static variable?&lt;br /&gt;
&lt;br /&gt;
c) Run it and find out. Put the code in part C in main, and IdentifyMyParts in a another file and give it the same name as the class name. If you don't understand the output trace it on paper and keep in mind what a static variable is. If you are still stuck, come back and ask specific questions about its behavior.&lt;br /&gt;
&lt;br /&gt;
Please don't post homework, expecting to be spoon-fed the answers. No one here will do your homework for you, and it will not help you.&lt;br /&gt;
&lt;em&gt;&lt;span style="color: Blue;"&gt;Just my 2 bits&lt;/span&gt;&lt;em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/em&gt;&lt;/em&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java/315196/315223/re-what-would-be-the-output/#315223</guid>
      <pubDate>Wed, 14 Sep 2005 09:59:30 -0700</pubDate>
      <category>Java</category>
    </item>
  </channel>
</rss>