我正在使用NetBeans 6.8.
我有一个类ClassA位于PackageA中JavaApplicationProject1.
我打算使用这个类ClassB位于PackageB在JavaApplicationProject2刚导入它.一种选择是复制ClassA的PackageB,但我不希望复制.我怎样才能做到这一点?
我有:
<?php
$goto = $_GET['goto'];
?>
Run Code Online (Sandbox Code Playgroud)
和:
<form method="get"><input type="text" name="goto" id="goTo" /></form>
<iframe id="page" src="http://<?php echo $goto; ?>"></iframe>
Run Code Online (Sandbox Code Playgroud)
如果我转到我的页面,除非我用URL结束,否则不显示任何内容?goto=<webadress>.
例: http://example.com/windows8/apps/Flake/index.php?goto=http://google.com
如何使用,如果用户没有输入?goto=http://google.com,页面显示为备份网站?
当我尝试从文件中读取整数时,代码最终会读取与预期不同的数字.
数据文件包含以下数字:
1111 111 222 333 444 555 666 777 888 -1
Run Code Online (Sandbox Code Playgroud)
当我读取文件时,它返回以下数字:
825307441 825307424 842150432 858993440 875836448
892679456 909522464 926365472 943208480 170994976
Run Code Online (Sandbox Code Playgroud)
为什么会这样?
相关代码:
/* A file named data contains some integer numbers.write a program to
read these numbers and store the odd numbers in one file and store
the even numbers in file.*/
int main()
{
FILE *fp1,*fp2,*fp3;
int number;
fp1=fopen("DATA","r");
fp2=fopen("even","w");
fp3=fopen("odd","w");
printf("numbers in file are\n");
while((number=getw(fp1))!=EOF)
{
printf("%d\t",number);
}
fclose(fp1);
fp1=fopen("DATA","r");
while((number=getw(fp1))!=EOF)
{
if((number%2)==0)
{
putw(number,fp2); …Run Code Online (Sandbox Code Playgroud) 随机码:
// Getting All Contacts
public List<Contact> getAllContacts() {
List<Contact> contactList = new ArrayList<Contact>();
// Select All Query
String selectQuery = "SELECT * FROM " + TABLE_CONTACTS;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
Contact contact = new Contact();
contact.setID(Integer.parseInt(cursor.getString(0)));
contact.setName(cursor.getString(1));
contact.setPhoneNumber(cursor.getString(2));
// Adding contact to list
contactList.add(contact);
} while (cursor.moveToNext());
}
// return contact list
return contactList;
}
Run Code Online (Sandbox Code Playgroud)
看看它在哪里
public List<Contact> getAllContacts() { …Run Code Online (Sandbox Code Playgroud) 我正在用Java编写一个函数来逐行读取PHP.我注意到有些行被跳过了.
Java中的函数:
public String ReadContentRegex(String path, String Regex) throws
FileNotFoundException, IOException
{
final StringBuilder contents = new StringBuilder();
BufferedReader br = new BufferedReader(
new InputStreamReader(new FileInputStream(path)));
try {
String line;
while ((line = br.readLine()) != null) {
System.out.println(br.readLine());
}
} finally {
br.close();
}
return contents.toString();
}
Run Code Online (Sandbox Code Playgroud)
Java应该使用的PHP文件BufferedReader:
<?php #if (!APP_ACT) exit();
class dbtest extends Codeplexon\core\fwcontroller {
public $name = __CLASS__;
static function destruct()
{
// ili 404
echo("Error function: ".__FUNCTION__);
}
public function db()
{
$model = …Run Code Online (Sandbox Code Playgroud) 我正在做一个(非常基本的)游戏.因此,我需要为(很多)实体存储数据.
所以我提出了这个概念:
String[] Entity_Data = new String[EntityCount];
Entity_Data[0] = "1 12 98 45";//Or other numbers...
Run Code Online (Sandbox Code Playgroud)
第一个数字可能是饥饿状态或步行速度,甚至是X或Y坐标.
有没有办法为数组中的每个变量赋予多个值?
请考虑以下字符串:
String test= "0, 1, 3, 2, 2, 1, 1, 4, 2, 5, 1, 1, 0, 1, 241";
Run Code Online (Sandbox Code Playgroud)
最大值是最后一个值241.如何15在字符串中获取此数字的计数,因为241是字符串中的第15个数字,并且是行中的最大数字?
第二个例子:
String test= "0, 1, 3, 2, 2, 1, 1, 4, 30, 5, 1, 1, 0, 1, 5";
Run Code Online (Sandbox Code Playgroud)
结果应该是9,因为30是最大的数字,而在字符串中的第9位.