Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Aluno {
- String nome;
- int idade;
- public Aluno(String nome,int idade) {
- this.nome = nome;
- this.idade = idade;
- }
- }
- import java.util.Scanner;
- public class Principal {
- public static void main(String[] args) {
- Scanner entrada = new Scanner(System.in);
- int idade = 0;
- String nome = null;
- Aluno aluno = new Aluno(nome, idade);
- System.out.println("Qual tu nome");
- aluno.nome = entrada.nextLine();
- System.out.println("Qual tu idade");
- aluno.idade = entrada.nextInt();
- System.out.println("Nome: " + aluno.nome + "\nIdade: " + aluno.idade);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement