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

Recommended Answers

All 2 Replies

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);
}
}

@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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.