Java

whosadork

Chieftain
Joined
Aug 13, 2008
Messages
20
How do i import information from one class to another, wouldn't this be it>>>


import java.(classname).(classinformation)


i thought that would be it...
 
import "packagename"."class"

for instance

import java.util.Scanner;

imports the Scanner class of package java.util.

this is a link to java's api http://java.sun.com/j2se/1.5.0/docs/api/ if you're not importing from the java api then just import whatever you named the package.

I have a strong suspicion though that what you really want to know do is use methods of an instance of an object to modify your current class somehow.
 
thx mate, yeah but i need certain information from it, like i need to take a comparison that user entered and Scan it, so i need to take only a certain ammout of info...
 
ya using import doesn't take information from classes it just gives you the ability to make instances of that class(or use their static methods)

it sounds like you want to do something like this

Code:
import java.util.Scanner;

public class UserInput{

public static void main(String args[]){

int userInput; 

 System.out.println("input information");
 
Scanner input = new Scanner(System.in);

userInput = input.nextInt();


}

}
 
Back
Top Bottom