只是想知道为什么静态总是首先打印出来而不是方法.
码:
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) 我已经在vmware上将我的ubuntu 12升级到14.04.完成后,似乎我收到4条消息显示"错误:找不到文件",然后它就会挂起.
有什么建议可以恢复吗?
从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) 我正在尝试使用StreamWriter指定存储创建文件的位置:
string getCurrentPath = Environment.CurrentDirectory;
StreamWriter writeFile = new StreamWriter(@"" +getCurrentPath + "\\NDependProject\\OceanAPIDependencies.xml");
writeFile.Close();
Run Code Online (Sandbox Code Playgroud)
我收到此错误消息:
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, …
.net ×1
android ×1
c# ×1
java ×1
sqlite ×1
ubuntu ×1
ubuntu-12.04 ×1
ubuntu-14.04 ×1
vmware ×1