这种方法有什么作用? [英] what does this methods do?

查看:81
本文介绍了这种方法有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是初学者

这个方法有什么作用?



 public String [] foo(String [] a)
{
String [] temp = new String [a.Length];
for(int i = 0; i< a.length; i ++)>
{
temp [i] = a [i] .toLowerCase();
}
返回临时; //这个陈述的功能??
}







 public int foo(int [ ] a)
{
int temp = 0;
for(int i = 0; i< a.length; i ++)>
{
if(a [i] == 5)
temp ++;
返回临时;
}

解决方案

您认为它有什么作用?

这并不复杂。



它返回一个与输入相同的字符串数组,除了字符串都是小写的:Hello World!成为你好世界!等等。



第二个更容易,所以我会让你自己解决这个问题:毕竟这是你的功课!

i'm beginner
what does this method do?

public String [] foo(String [] a)
{
String [] temp = new String[a.Length];
for(int i =0;i<a.length;i++)>
{
   temp[i]=a[i].toLowerCase();
}
 return temp; //function of this statement??
}


also,

public int foo(int [] a)
{
int temp=0;
for(int i=0;i<a.length;i++)>
{
 if(a[i]==5)
temp++;
return temp;
}

解决方案

What do you think it does?
It's not exactly complicated.

It returns an array of strings that is the same as the input, except the strings are all in lowercase: "Hello World!" becomes "hello world!" and so forth.

The second one is even easier, so I'll let you work that one out on your own: it's your homework, after all!


这篇关于这种方法有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆