我使用的是XAMPP,版本3.2.1.我刚刚在Windows 8上安装它.每次我都需要去XAMPP控制面板启动服务(MySQL,Apache,...); 在Windows 7中,它在Windows出现时自动启动.
有什么办法可以让它在Windows 8中自动启动吗?
为什么BufferedReader类有一个readLine()方法,但是BufferedWriter类没有writeLine(String)方法?现在我们要做的write(str + "\n")还是write(str)和newLine().
伪代码
提供的片段将被视为伪代码.如果有一个不同的解决方案是解决这个问题的标准方法,我愿意接受.
这与预期用量有关:
一些澄清:
Main.java不能允许@Override.Configuration.java不能是一个Interface默认值应该给不被覆盖的字段.Configuration.java将从其目前的两个领域大幅增长.渲染构建器模式非常混乱.Configuration.java
public class Configuration
{
public static int getFoo () { return 1; }
public static int getBar () { return 2; }
}
Run Code Online (Sandbox Code Playgroud)
UserDefinedConfiguration.java
public class UserDefinedConfiguration extends Configuration
{
@Override
public static int getFoo () { return 3; }
}
Run Code Online (Sandbox Code Playgroud)
Main.java
public final class Main {
private final Configuration config;
// default configuration
public Main () {
this (Configuration.class);
}
// …Run Code Online (Sandbox Code Playgroud) 我是Java的新手,正在尝试学习线程。
我期待输出的替代hello this is thread one和hello this is thread two。但是我得到的输出如下:
hello this is thread one
hello this is thread one
hello this is thread one
hello this is thread one
hello this is thread one
hello this is thread two
hello this is thread two
hello this is thread two
hello this is thread two
hello this is thread two
Run Code Online (Sandbox Code Playgroud)
下面是我的代码。谁能帮我解决为什么我得到此输出而不是预期的结果。我可以做两个并行运行的线程。
public class ThreadDemo {
public static void main(String args[]) {
// This is the first …Run Code Online (Sandbox Code Playgroud) 现在的问题是,如果它是首选,以Throw一个exception或防止它不断发生.这是一个游戏项目.
IndexOutOfBoundsException 与编码相关.
我有一个 List<E>
private Attribute<List> attributes;
Run Code Online (Sandbox Code Playgroud)
一种通过索引获取项目的方法.
public Attribute getAttribute (int index) {
if (index < 0 || index >= attributes.size())
index = 0;
return attributes.get(index);
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我默认为列表的第一个元素.
使用这两个作为参考
http://msdn.microsoft.com/en-us/library/ms229017(v=vs.110).aspx
我想知道在我的情况下推荐什么(最好是为什么).我目前正在构建库存管理器,添加,删除,移动,删除项目.(稍后会装备/装备,但它们不会直接与我的库存集成,因为库存只管理删除(装备)和添加(用于非装备)
所以无论是类还是结构,这都是问题所在!
一个人指出一个8字节的限制,msdn说16.按Item类将比那更多.
private string _name;
private string _desc;
private bool _dropable;
private int _price;
private int _maxQuantity;
Run Code Online (Sandbox Code Playgroud)
我的ItemSlot结构/类将具有Item(或int _itemId)以及数量.应该(是的?)加起来超过16个字节.
private ItemSlot[] _inventory;
public const int INVENTORY_SIZE = 50;
public Party () {
ItemSlot[] _inventory = new ItemSlot[INVENTORY_SIZE];
}
Run Code Online (Sandbox Code Playgroud)
我试着遵循的教程系列使用了一个结构,但是; 现在有了这些知识,我是正确的,我应该有一个项目插槽的课程?或者我的理解是否浅薄?
一个简化的场景。三个班级,祖父母,父母和孩子。我想要做的是利用 GrandParent 和 Parent 构造函数来初始化 Child 实例。
class GrandParent ()
{
public int A {get; protected set;}
public int B {get; protected set;}
public GrandParent (int a, int b);
{
A = a;
B = b;
}
}
class Parent : GrandParent ()
{
public Parent () {}
}
Run Code Online (Sandbox Code Playgroud)
子类,出现问题。
class Child : Parent ()
{
public int C {get; protected set}
public Child (int c) // here I want it to also call the GrandParent (int a, int b) …Run Code Online (Sandbox Code Playgroud) 所以给出数据例如:
a898 //result string1=a string2=898
b832 //string1=b string2=832
c3232 //string1=c string2=3232
d938202 //string1=d string2=938202
Run Code Online (Sandbox Code Playgroud)
我正试图把这封信放进去String,然后将其余的数字放在另一封信中String.我正在使用charAt(0)这封信,但由于它们的长度并不完全相同,我在找到分割数字的方法时遇到了问题.
我使用的一种方法,当没有26个差异选项时,在另一个程序中替换a为a|,bwith b|,依此类推,然后拆分|.它导致非常丑陋的代码,我希望有另一种选择.谢谢你的时间!
有ArrayList超过10000件物品.我试图通过一个HashSetO(n)复杂性的操作使它们成为唯一的.还有其他算法/ DS可以制作出Collection比O(n)更低复杂度的唯一算法吗?