我一直在研究Java中的静态内部类。但是我不清楚使用静态内部类或内部类有什么意义。
class A{
static class B{
}
public static void main(String[] args) {
B b=new B();
}
}
Run Code Online (Sandbox Code Playgroud)
要么
class B{}
class A{
public static void main(String[] args) {
B b=new B();
}
}
Run Code Online (Sandbox Code Playgroud) 说我有这些值的列表:
['1', '91', '70', '2', '84', '69', '3', '86', '68', '4', '84', '68', '5', '83', '70', '6', '80', '68', '7', '86', '73', '8', '89', '71', '9', '84', '67', '10', '83', '65', '11', '80', '66', '12', '86', '63', '13', '90', '69', '14', '91', '72', '15', '91', '72', '16', '88', '72', '17', '97', '76', '18', '89', '70', '19', '74', '66', '20', '71', '64', '21', '74', '61', '22', '84', '61', '23', '86', '66', '24', '91', '68', '25', '83', '65', '26', '84', '66', '27', …Run Code Online (Sandbox Code Playgroud) 所以我一直试图从CL格式化所拍摄的网页,所以我可以将它发送到我的电子邮件,但这是我每次尝试删除\n和\t
b'\n\n\n\t\n\t\n\t\n\t\n\t\n\t\n\n\n\n\t\n\n\n\t
\n\t\t\t
\n\t
\n\t\t
\n\t\t\t
\n 0 favorites\n
\n\n\t\t
\n\t\t
?
\n\t\t
?
\n\t\t
\n \n
\n
\n\t \tCL wenatchee all personals casual encounters\n
\n
\n\t\t
\n\t
\n
\n\n\t\t
\n\t\t\t
\n\t\n\t\t\n\t\n\n\n\nReply to: 59nv6-4031116628@pers.craigslist.org\n
\n\n\n\t
\n\t\n\t\tflag [?] :\n\t\t\n\t\t\tmiscategorized\n\t\t\n\t\t\tprohibited\n\t\t\n\t\t\tspam\n\t\t\n\t\t\tbest of\n\t\n
\n\n\t\t
Posted: 2013-08-28, 8:23AM PDT
\n
\n\n
\n \n Well... - w4m - 22 (Wenatchee)\n
Run Code Online (Sandbox Code Playgroud)
我已经尝试过剥离,替换甚至正则表达但没有任何目击它,它总是出现在我的电子邮件中,不受任何影响.
这是代码:
try:
if url.find('http://') == -1:
url = 'http://wenatchee.craigslist.org' + url
html = urlopen(url).read()
html = str(html)
html = re.sub('\s+',' ', html) …Run Code Online (Sandbox Code Playgroud) 这是代码片段:
private double input()throws IOException
{
StringTokenizer st=null;
BufferedReader b=new BufferedReader(new FileReader(csvfile));
String line=null;
int count=0;
while((line=b.readLine())!=null)
{
count+=1;
if(count==0)
{
return 0.0;
}
else
{
int sum=0;
String[] arr=new String[19];
st=new StringTokenizer(line,",");
int i=0;
while(st.hasMoreTokens())
{
arr[i]=st.nextToken();
i++;
}
for(int j=2;j<arr.length;j++)
{
if(j==13)
{
return Double.parseDouble(arr[j]);
}
}
System.out.println();
}
}
}
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我为if-else梯形图的两个案例都添加了一个return语句.Eclipse仍然要求我添加一份退货声明.由于同样的原因,执行代码会引发错误.(错误This method must return a result of type double:)为什么会发生这种情况?
背景:上述方法是读取CSV文件并根据另一种方法的要求返回文件的某些部分,这里没有显示.