Retroceder   PuntoSitio.com - Mercado / Marketplace de los webmasters y emprendedores > Diseño y Desarrollo > Programación > JavaScript

Respuesta
 
Herramientas Desplegado
  #1  
Antiguo 13-11-2008, 22:11:55
!t4Ch1! !t4Ch1! is offline
Junior Member
 
Registrado: nov 2008
Posts: 1
iTrader: (0)
Predeterminado ¿reportar mas de un apellido en java con String?

estoy que trabajo en objetos (o1 es el nombre de mi objeto)
tengo esto
"n" es mi número de trabajadores en este caso le puse 2
String ape,nom;
int n;
System...("Ingrese Cantidad de Trabajadores: ");
n=Integer.parseInt(br.readLine());

for(i=0;i<n;i++)
{
System....("ingrese el nombre")
nom=br.readLine();

System....("ingrese el apellido")
ape=br.readLine();
o1.apellido(ape);
o1.nombre(nom);
}
System...("El apellido de los trabajadores es")+o1.apellido;
System...("El nombre de los trabajadores es")+o1.nombre;

double dat=0,dat 1=0;
void apellidos(String ape)
{
dat=ape;
}
void nombres(String nom)
{
dat1=nom;
}


String apellido()
{
return dat;
}
String nombre()
{
return dat1;
}


me sale solo el ultimo apellido y el ultimo nombre


intente ponerle un acumulador :S
dat=dat+ape;
dat1=dat1+nom;
y al final me salia
nullTAPIAHERRERA [me salia junto](TAPIA 1ER APELLIDO HERRERA SEGUNDO APELLIDO)
nullJOELFRANKLIN [me salia junto](JOEL 1ER NOMBRE FRANKLIN 2DO NOMBRE)

alguien me podria ayudar?
Responder Con Cita
Links Recomendados
Respuesta


Herramientas
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT. Ahora son las 14:41:34.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Forum SEO by Zoints