软件开发工程师面试题与解答大全.docxVIP

  • 2
  • 0
  • 约1.04万字
  • 约 33页
  • 2026-03-11 发布于福建
  • 举报

第PAGE页共NUMPAGES页

2026年软件开发工程师面试题与解答大全

一、编程语言基础(共5题,每题6分)

1.题目:

请用Java编写一个方法,实现将一个字符串中的所有空格替换为`%20`。要求不使用内置的`replace`方法。

答案:

java

publicclassURLify{

publicstaticvoidreplaceSpaces(char[]str,inttrueLength){

intspaceCount=0;

for(inti=0;itrueLength;i++){

if(str[i]==){

spaceCount++;

}

}

intindex=trueLength+spaceCount2;

for(inti=trueLength-1;i=0;i--){

if(str[i]==){

str[index-1]=0;

str[index-2]=2;

str[index-3]=%;

index-=3;

}else{

str[index-1]=str[i];

index--;

}

}

}

publicstaticvoidmain(String[]args){

char[]str=MrJoh

文档评论(0)

1亿VIP精品文档

相关文档