0

Hi Frnds,
Sorry For The Spam .

i have a class name"Super"
program:

package turn;
  public class Super {
  public static String platformFlag=null;
   
public void parse()
{
platformFlag="Sekhar";
}
public static void main(String args[])
{
Super ob=new Super();
ob.parse();
}
}
-------------------------------------------------------------------------------
Now i have another class in the same package
package turn;
public class Model {
public void result(Super dupObj){
:'( System.out.println("Value of platformFlag" +dupObj.platformFlag);
}
public static void main(){
Model my=new Model();
Super sObject = new Super();
my.result(sObject);
}
}

---------------------------------------------------------------------------------
but when iam printing the value of platformFlag from the class Model it is printing null..:'( .?

:) could anyone of here tell me wat is the reason .
and Tell me the rway how to print value as sekhar

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by stephen84s
0

your app bit more OO-minded

package turn;
  public class Super {
  private String platformFlag=null;
  
  public Super(){
     setPlatformFlag("sekhar");
  }

  public void setPlatformFlag(String in){
     this.platformFlag = in;
  }

  public String getPlatformFlag(){
     return this.platformFlag;
  }
}
package turn;
public class Model {
public void result(Super dupObj){
System.out.println("Value of platformFlag"  + dupObj.getPlatformFlag());
}
public static void main(){
Model my=new Model();
Super sObject = new Super();
my.result(sObject);
}
}
0

@babusek
This is your twentieth post and still you have not used code tags. Are you just plain ignorant to not go through the Community rules or the Announcements or at least observe how other posters post in the forum.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.