Skip to content

Instantly share code, notes, and snippets.

@raziyeaydin
Last active December 30, 2015 02:59
Show Gist options
  • Save raziyeaydin/7766416 to your computer and use it in GitHub Desktop.
Save raziyeaydin/7766416 to your computer and use it in GitHub Desktop.
package kitap.bolum10.nyp;
import java.util.Scanner ;
public class Insan { // Insan adında bir sınıf oluşturuldu.
static double boy ; //
static String cinsiyet ; // Sınıfa ait özellikler
static int yas ; //
static String isim ; //
public static void bilgi(){
Scanner tara = new Scanner(System.in);
System.out.print("isminizi giriniz: ");
isim = tara.nextLine();
System.out.print("boyunuzu giriniz: ");
boy = tara.nextDouble();
//Kullanıcı bilgilerinin alınması
System.out.print("cinsiyetinizi yazınız: ");
cinsiyet = tara.next();
System.out.print("yaşınızı yazınız: ");
yas = tara.nextInt();
}
public static void main(String[] args) {
Insan kisi = new Insan(); //Insan sınıfına ait kisi adlı nesnenin oluşturulması
bilgi(); //oluşturulan metodun kullanılması
System.out.print(kisi.isim+","+kisi.yas+" yaşında "+kisi.boy+" boyunda "+"cinsiyeti ise "+kisi.cinsiyet); //bilgilerin ekrana yazdırılması...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment