如题所述
第1个回答 2009-10-09
java :
class TestString{
String s[] ;
public TestString(int length){
s=new String [lenth];
}
private void setter(){
}
private void getter(){
}
private void dispS(){
if(s==null){
System.out.println("s is null ! ");
}else{
for(int i=0 ;i<s.length;++i)
System.out.println(this.s[i]);
}
}
}
c++:
#include <string>
#include <iostream>
using namespace std ;
const int LENGTH =10 ;
class str {
public: str (){
}
~str(){
}
void setter (){
}
void getter(){
}
void dispStr(){
for (int i =0 ;i <LENGTH;i++){
cout<< s[i]<<endl;
}
}
private :string s [LENGTH] ;
};
int main(){
}本回答被网友采纳
class TestString{
String s[] ;
public TestString(int length){
s=new String [lenth];
}
private void setter(){
}
private void getter(){
}
private void dispS(){
if(s==null){
System.out.println("s is null ! ");
}else{
for(int i=0 ;i<s.length;++i)
System.out.println(this.s[i]);
}
}
}
c++:
#include <string>
#include <iostream>
using namespace std ;
const int LENGTH =10 ;
class str {
public: str (){
}
~str(){
}
void setter (){
}
void getter(){
}
void dispStr(){
for (int i =0 ;i <LENGTH;i++){
cout<< s[i]<<endl;
}
}
private :string s [LENGTH] ;
};
int main(){
}本回答被网友采纳