import cs1.Keyboard;
import java.util.Scanner;
class P 
{
    private static String name;
    private String persnr;
    private String adress;
    private int age;

    public Person(String _name, String _persnr, String _adress, int _age) 
    {
        name = name;
        persnr = persnr;
        adress = adress;
        age = age;
    }
    
    public void byterNamn(String _name)
    {
        name = _name;
    }
    
    public void byterAdress(String _adress)
    {
        adress = _adress;
    }
    
    public void fyllerAr()
    {
        age = age + 1;
    }
    
    public String hamtaNamn()
    {
        return name;
    }
    
    public String hamtaPersonnmmer()
    {
        return persnr;
    }
    
    public String hamtaAdress()
    {
        return adress;
    }
    
    public int hamtaAlder()
    {
        return age;
    }
    
    public String toString()
    {
    String _toString;
    _toString = "Namn: " + name + "\nÅlder: " + age;
    _toString = _toString +  "\nPersonnummer: " + persnr + "\nAdress: " + adress;
    System.out.print(_toString);
    return _toString;
    }
    
    public static void main(String[] args) 
    {
	 
System.out.println("namn: ");
name = Keyboard.readString();    

System.out.println( "adress: " );
String adress = Keyboard.readString();

System.out.println( "ålder: " );
Integer age = new Integer(); age.parseInt(Keyboard.readint() );

System.out.println( "personnummer: " );
String persnr = Keyboard.readString(); 

Person p1 = new Person(name, persnr, adress, age);
p1.toString();

System.out.println( "nytt namn p1:" );
name = Keyboard.readString();
p1.byterNamn( name );
p1.fyllerAr(); 
p1.toString();
    }
}

i ger 2 errors:
error: cannot find symbol
Integer age = new Integer(); age.parseInt(Keyboard.readint() );
and the arrow is under . in Keyboard.readint

no suitable constructor found for Integer()
Integer age = new Integer(); age.parseInt(Keyboard.readint() );
the arrow is under new

Does the Keyboard class have a static method: readint()?

Integer age = new Integer(); age.parseInt(Keyboard.readint() );

Is this a typo? There is a ; in the middle of the statement.

Don't put two statements on the same line.
The parseInt method is static, you do not need an instance of the class to use it:
... Integer.parseInt(....

Use the classname just like you are using Keyboard

Integer age = new Integer(); age.parseInt(Keyboard.readint() );

What NormR1 just suggested , that and i think readInt() might be the correct one. I don't know check the syntax

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.