If I create a class to be used by an application how can I display some of the information from the class. I am using get and set for the information but as soon as I add the public static void line so I can have a display method everything screws up. Do I sound lost? I am.

Very simple create instance and initialize the class that will be your data holder, then trough instance access any available methods and retrieve data as need it. Bellow example should be sufficient

public class Person{
	
	private String firstName, lastName;
	
	public Person(String _firstName, String _lastName){
		setFirstName(_firstName);
		setLastName(_lastName);
	}
	
	private void setFirstName(String _firstName){
		firstName = _firstName;
	}
	
	public String getFirstName(){
		return firstName;
	}
	
	private void setLastName(String _lastName){
		lastName = _lastName;
	}
	
	public String getLastName(){
		return lastName;
	}
}
public class PersonTest{
	
	public static void main(String[] args){
		Person person = new Person("peter","somebody");
		System.out.println("First name : "+ person.getFirstName() 
			+ "\nLast name : " + person.getLastName());
	}
}
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.