以下程序从时间服务器获取时间有什么问题.
public class SocketTest
{
public static void main(String[] args)
{
Socket s = new Socket(“time-A.timefreq.bldrdoc.gov”, 13);
BufferedReader in = new BufferedReader(
new InputStreamReader(s.getInputStream()));
String line;
do
{ line = in.readLine(); //read line of text from socket
if (line != null) System.out.println(line);
}
while(line != null);
}
}
Run Code Online (Sandbox Code Playgroud) 因此,我的老师告诉我要制作一个字符串,使我输入的任何东西按相反的顺序排列(例如"你好那里"变成"ereht olleh").到目前为止,我在身体上工作,我想出了这个
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
(The input needs to be in here)}}
public static String rev(String str) {
String reversed = "hello there";
for (int i = 0; i < str.length(); i++) {
reversed = str.charAt(i) + reversed;
}
return reversed;
Run Code Online (Sandbox Code Playgroud)
我现在的问题是我需要在public static void main(String [] args)下放置它才能使它工作.是的,我明白这是家庭作业,我试着通过这本书寻求帮助(没有运气).我试着在互联网上寻找(没有运气,这要归功于我对更先进的方法的了解不多).我将不胜感激任何帮助,并提前感谢任何人.我使用netbeans,如果这会有所帮助.
我有这个赋值来实现strcmp函数.有时它运行正常,但有时它会崩溃.请帮我.
#include <iostream>
using namespace std;
int mystrcmp(const char *s1, const char *s2);
int main()
{
cout<<mystrcmp("A","A")<<endl;
cout<<mystrcmp("B","A")<<endl;
cout<<mystrcmp("A","B")<<endl;
cout<<mystrcmp("AB","A")<<endl;
return 0;
}
int mystrcmp(const char *s1, const char *s2)
{
while (*s1==*s2)
{
s1++;
s2++;
}
if(*s1=='\0')
return(0);
return(*s1-*s2);
}
Run Code Online (Sandbox Code Playgroud) 如何检索那些以AOR BOR 开头的角色星的记录C,
我刚试过这个查询
SELECT * FROM `test_tbl` WHERE Left(cus_name, 1) = 'a'
---> display all customer name starting with character a
Run Code Online (Sandbox Code Playgroud)
我还添加了一个条件,就是这样
SELECT * FROM `test_tbl` WHERE Left(cus_name, 1) = 'a' or Left(cus_name, 1) = 'b'
--->It displayed all customer name starting with character a and in some records middle i saw some name starting with b also,
Run Code Online (Sandbox Code Playgroud)
我想是的,我想拔出记录,这名开头A或B或者C,
它也应按字母顺序排序,
我也尝试了以下查询.
SELECT * FROM `test_tbl` WHERE Left(cus_name, 1) …Run Code Online (Sandbox Code Playgroud) 我使用下面的代码片段来验证我的输入字符串:只有大写字母,数字和两个特殊字符(那些是&和Ñ)并且之间没有任何空格.
var validpattern = new RegExp('[^A-Z0-9\d&Ñ]');
if (enteredID.match(validpattern))
isvalidChars = true;
else
isvalidChars = false;
Run Code Online (Sandbox Code Playgroud)
测试1:"XAXX0101%&&$#"应该失败即isvalidChars = false;(因为它包含无效字符,如%$#.
测试2:"XAXX0101&Ñ3Ñ&"应该通过.
测试3:"XA 87B"应该失败,因为它之间包含空格
上面的代码不起作用,任何人都可以帮我纠正上面的正则表达式.
for (Season time : Season.values() )
system.out.println (time+ "\t" + time.getSpan());
Run Code Online (Sandbox Code Playgroud)
我看到了使用枚举的一个例子:.这是什么意思?
我在Linux下使用C++编译标准GCC.在我的程序中,我想添加一个显示HH:MM:SS的简单时钟.最简单的方法是什么?
有没有办法知道可执行文件中使用了哪些共享库?
以DivFix ++为例:
$ file DivFix++
DivFix++: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
Run Code Online (Sandbox Code Playgroud) 我在验证规则中有以下正则表达式:
^[a-zA-Z0-9',!;?~>+&\"\-@#%*.\s]{1,1000}$
Run Code Online (Sandbox Code Playgroud)
但是,我可以输入======我认为不应该被允许的内容.
我的想法是,不管怎样,-如果没有适当地逃脱,可能会造成麻烦,但这种情况已经超出我的想象.
我只是想知道是否有任何设置%PATH%变量的方法,所以我可以编译我的Java代码,以及我的Python代码?
例如.. PATH目前C:\ ... JDK_bin blah blah,就是这样.要运行我的python代码,我必须完全更改我的路径变量.
任何答案?