Skip to content

Instantly share code, notes, and snippets.

@mrnirva
Created September 5, 2020 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrnirva/6ecf4c5503740124cbc3467a400b5384 to your computer and use it in GitHub Desktop.
Save mrnirva/6ecf4c5503740124cbc3467a400b5384 to your computer and use it in GitHub Desktop.
package scannerdersi;
import java.util.Scanner;
public class ScannerDersi {
public static void main(String[] args) {
// Scanner nesnesini oluşturmak
Scanner sc = new Scanner(System.in);
//*******************************************
// Metin Girdisi Almak
System.out.println("Metin Gir: ");
String stringMetin = sc.nextLine();
System.out.println("Kelime Gir: ");
String stringKelime = sc.next();
//*******************************************
// Tam Sayı Girdisi Almak
System.out.println("Tam Sayı Gir: ");
byte byteSayi = sc.nextByte();
short shortSayi = sc.nextShort();
int intSayi = sc.nextInt();
long longSayi = sc.nextLong();
//*******************************************
// Ondalıklı Sayı Girdisi Almak
System.out.println("Ondalıklı Sayı Gir (Virgül Kullanın): ");
float floatSayi = sc.nextFloat();
double doubleSayi = sc.nextDouble();
//*******************************************
// Verileri yazdırmak
System.out.println("Girilen Metin " +stringMetin);
System.out.println("Girilen Kelime " +stringKelime);
System.out.println("Girilen Tam Sayılar: " +byteSayi+" | "+shortSayi+" | "+intSayi+" | "+longSayi);
System.out.println("Girilen Ondalıklı Sayılar: " +floatSayi+" | "+doubleSayi);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment