Nombre Y Apellido JAVA

package javaapplication7;
import java.util.Scanner;
public class JavaApplication7 {

    public static void main(String[] args) {
        Scanner teclado = new Scanner(System.in);
        String NombreyApellido1, NombreyApellido2;
        int Edad1,Edad2;
        System.out.println("INGRESE NOMBRE Y APELLIDO #1");
        NombreyApellido1=teclado.nextLine();
        System.out.println("INGRESE LA EDAD");
        Edad1=teclado.nextInt();
        System.out.println("INGRESE NOMBRE Y APELLIDO #2");
        teclado.nextLine();
        NombreyApellido2=teclado.nextLine();
        System.out.println("INGRESE LA EDAD");
        Edad2=teclado.nextInt();
        System.out.println("EL DE MAYOR EDAD ES");
        if (Edad1>Edad2){
            System.out.println(NombreyApellido1);
        }
        else
            System.out.println(NombreyApellido2);
        }
    }

Share this

Related Posts

Previous
Next Post »