小编Khi*_*uan的帖子

Java为什么静态打印出文本而不是方法

只是想知道为什么静态总是首先打印出来而不是方法.

码:

public class TestMe {
    static {
        System.out.println("D");
    }

    {
        System.out.println("B");
    }


    public void printMe() {
        System.out.println("Z");
    }

    public static void main(String []args) {
        new TestMe().printMe();
    }

}
Run Code Online (Sandbox Code Playgroud)

输出:

D
B
Z
Run Code Online (Sandbox Code Playgroud)

java

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

VMware等.错误:找不到文件Ubuntu在升级版本后无法启动

我已经在vmware上将我的ubuntu 12升级到14.04.完成后,似乎我收到4条消息显示"错误:找不到文件",然后它就会挂起.

有什么建议可以恢复吗?

ubuntu vmware ubuntu-12.04 ubuntu-14.04

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

Android SQLite cursoroutofboundsexception

从SQLite获取对象(getRecipe()方法)的问题,因为我得到了一个cursoroutofbounds异常.

这是代码:

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

import com.apps.database.sqlite.model.Ingredients;
import com.apps.database.sqlite.model.Photo;
import com.apps.database.sqlite.model.Recipe;

public class RecipeDbHelper extends SQLiteOpenHelper {
    private static final String LOG = "DatabaseHelper";
    private static final String DATABASE_NAME = "RecipeManager";
    private static final int DATABASE_VERSION = 11;
    private static final String TABLE_RECIPE = "recipe";
    private static final String TABLE_INGREDIENT = "ingredients";
    private static final String TABLE_PHOTO = "photo";
    private static …
Run Code Online (Sandbox Code Playgroud)

sqlite android

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

使用StreamWriter存储在特定路径中

我正在尝试使用StreamWriter指定存储创建文件的位置:

string getCurrentPath = Environment.CurrentDirectory;
StreamWriter writeFile = new StreamWriter(@"" +getCurrentPath + "\\NDependProject\\OceanAPIDependencies.xml");
writeFile.Close();
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息:

    Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part
 of the path 'D:\Project_Summer\ExtensionDirectoryTraversal\ExtensionDirectoryTr
aversal\bin\Debug\NDependProject\OceanAPIDependencies.xml'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, I
nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions o
ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolea
n useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean
bFromProxy, …
Run Code Online (Sandbox Code Playgroud)

.net c# visual-studio-2012

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