小编Jos*_*hDM的帖子

如何在NetBeans中引用其他项目的类?

我正在使用NetBeans 6.8.

我有一个类ClassA位于PackageAJavaApplicationProject1.

我打算使用这个类ClassB位于PackageBJavaApplicationProject2刚导入它.一种选择是复制ClassAPackageB,但我不希望复制.我怎样才能做到这一点?

java netbeans6.8

1
推荐指数
1
解决办法
8010
查看次数

PHP GET url iframe

我有:

<?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,页面显示为备份网站?

php url iframe get

0
推荐指数
1
解决办法
1097
查看次数

为什么应用程序从文件中读取不正确的整数?

当我尝试从文件中读取整数时,代码最终会读取与预期不同的数字.

数据文件包含以下数字:

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)

c

0
推荐指数
1
解决办法
266
查看次数

这段代码<>在java中是什么意思

随机码:

// 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 tags generics

0
推荐指数
1
解决办法
242
查看次数

为什么BufferedReader在读取PHP文件时会跳过一些行?

我正在用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)

java inputstream readfile

0
推荐指数
1
解决办法
516
查看次数

如何赋予变量多个值?

我正在做一个(非常基本的)游戏.因此,我需要为(很多)实体存储数据.

所以我提出了这个概念:

String[] Entity_Data = new String[EntityCount];
Entity_Data[0] = "1 12 98 45";//Or other numbers... 
Run Code Online (Sandbox Code Playgroud)

第一个数字可能是饥饿状态或步行速度,甚至是X或Y坐标.

有没有办法为数组中的每个变量赋予多个值?

c# arrays variables

0
推荐指数
1
解决办法
2万
查看次数

如何确定字符串中的最大值编号?

请考虑以下字符串:

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位.

java string return-value

-7
推荐指数
2
解决办法
1万
查看次数

标签 统计

java ×4

arrays ×1

c ×1

c# ×1

generics ×1

get ×1

iframe ×1

inputstream ×1

netbeans6.8 ×1

php ×1

readfile ×1

return-value ×1

string ×1

tags ×1

url ×1

variables ×1