SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > General > General Topics > Subsim 3.0 R & D
Forget password? Reset here

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 06-17-12, 05:28 AM   #1
McBeck
Admiral
 
McBeck's Avatar
 
Join Date: Feb 2001
Location: Denmark
Posts: 2,023
Downloads: 15
Uploads: 0


Default 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());
    }
}
This is located in "MySecondProjectAcitivity.java"

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;
    }
}
This is for the Account class, its varibles, methods and contructors.

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
McBeck is offline   Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:52 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.