Hello world en java

Solo disponible en BuenasTareas
  • Páginas : 2 (461 palabras )
  • Descarga(s) : 0
  • Publicado : 23 de enero de 2011
Leer documento completo
Vista previa del texto
Public class HelloWorld {
Public static void main(String[] args) {
System.out.println(“Hello World¡”);
}
}

Public class Rangos {
Public static void main (String[] args) {System.out.println(Math.sqrt(-1));
System.out.println(1.1e200*1e1200);
System.out.println(-1.1e200*1.1e200);
}
}

Public class Strings {
Public static void main (String[] args) {
String cad1 = “El numero “;String cad2 = “Es el siguiente: “;
String cad1 = String.valueOf(9483);
String cad1 = cad1 + cad2 + cad3;
}
}

Public class EjemploArrays1 {
Public static void main(String[] args) {
Int[]miArray;
miArray = new int [2];
miArray [0] = 24;
miArray [1] = 33;
System.out.println(“Valor 0: “ + miArray[0]);
System.out.println(“Valor 1: “ + miArray[1]);
miArray[2] =45;System.out.println(“Valor 2: “ + miArray[2]);
}
}

Public class EjemploArraysLength {
Public static void main (String[] args) {
Int[] a = new int [] {1,3,5};
System.out.println(“La longitude es : “ + a.length);
}}

Public class Incrementos {
Public static void main (String [] args) throws Exception {
Int j = 5;
Int k = j++;
System.out.println(“j vale :” + j + “, k vale : “ + k);
Int l = ++j;System.out.println(“j vale: “ + j + “, l vale: “ + l );
}
}
Public class NumerosPares {
Public static void main (String[] args) {
For(int I = 1; 1<=20; i++) {
}
System.out.println(“Numeropar: “ + i);
}
Else {
System.out.println(“Numero impar: “ + i);
}
}
}
}
Public class OperadoresRelacionales {
Public static void main (String[] args) {
String s = “cadena”;
String p =“otra cadena”;
Boolean res = “cadena”.equals(s);
Boolean res2 = s.equals (p) ;
System.out.println(“res vale: “ + res + “, y res2 vale: “ + res2);
}
}
Public static void main (String[] args) {
Inta, b;
Boolean r;
A = 3;
B = 8;
R = a !=0 b>a;
Int num = 0;
If (num<0 && 3/num==0) {
System.out.println(“uno”);
} else {
System.out.println(“dos”);
}
}
Public class...
tracking img