/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejer1variables;
import java.util.Calendar;
import java.util.GregorianCalendar;
/**
*
* @author Paulo
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Empezamos a declarar variables
String nombre; // tipo cadena de caracteres
int edad; // tipo entera
boolean esJubilado; // variable solo puede tomar 2 valores: true o false
float salario; // datos con punto decimal
char vocalPreferida; // solo puede almacenar un caracter
// Asignamos valores
nombre="Juan Perez";
edad=45;
esJubilado=false;
salario=904.67f;
vocalPreferida='a';
// imprimimos en la consola
System.out.println("Sr."+nombre);
System.out.println("Es Jubilado? "+esJubilado);
System.out.println("Su salario es: "+ salario);
System.out.println("Su vocal favorita es: "+ vocalPreferida);
}
}
Descarga el proyecto desarrollado con Ide netbeans ejercicio1