SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
06-17-12, 05:28 AM | #1 |
Admiral
|
Fooling aroind with Java
OK, so I created a package called "the.stuff.needed"
with this code: Code:
package the.stuff.needed; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class MySecondProjectActivity extends Activity { /** Called when the activity is first created. */ TextView textView1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Account account1 = new Account("Burd","222 Cyberspace Lane", 24.02); textView1=((TextView) findViewById(R.id.textView1)); textView1.setText (account1.infoString()); } } In "Account.java" I have created below: Code:
package the.stuff.needed; public class Account { public String name; public String address; public double balance; public Account(String name, String address, double balance) { this.name=name; this.address=address; this.balance=balance; } public String infoString() { return name + " ( " + address + " ) has $" + balance; } } How can I be sure that the MySecondProjectAcitivity.java looks in Account.java?
__________________
"I like subcommanders...they dont have time for bull****!" Proud member of the Subsim army of zombies Becks website |
|
|