Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication1;
- public class Alumno
- {
- private String nombre;
- public Alumno(String nombre)
- {
- this.nombre = nombre;
- }
- public String getNombreAdmiracion()
- {
- return nombre.concat("!");
- }
- public static int recorrer(String cadena)
- {
- int res = 0;
- for (int i = 1; i < cadena.length(); i++) //le sacamos el =, puede tambien ser length()-1
- {
- if (cadena.charAt(i) != ' ')
- {
- res++;
- }
- }
- return res;
- }
- public int getValor()
- {
- int vector[] = {6, 16, 26, 36, 46, 56, 66, 76};
- int idx = 7;
- //int retorno[] = Alumno.agregarElemento(vector, 15);
- return vector[8];
- }
- /*
- public static int[] agregarElemento(int[] vector, int elemento)
- {
- int vectorNuevo[] = new int[vector.length+1];
- for(int i = 0; i < vector.length; i++)
- {
- vectorNuevo[i] = vector[i];
- }
- vectorNuevo[vector.length] = elemento;
- return vectorNuevo;
- }
- */
- public static char getPrimerCaracter(String palabra)
- {
- String string[] = new String[5];
- string[1] = palabra;
- return (string[1].charAt(1));//.charAt(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement