我有以下表结构:

badge_id并且interface_id是主键.
当我尝试仅指定INSERT操作时badge_id,我预计它会失败,但interface_id 默认为0.

我正在运行以下版本:

有人可以解释为什么它默认为零?这不应该失败吗?提前致谢.
鉴于下一个代码:
//这是某个大方法的一部分//
ArrayList<String> players = this.m_maze.getPlayers();
// define the first node to be the human player , and pop him from the list
// the rest of the nodes are the computer side
Iterator<String> iterator = players.iterator();
// human side
String humanPlayer = iterator.next();
// controller - start a game between the players , at least two players are playing
while (this.m_rounds > 0)
{
String[] choices = this.m_view.getChoiceFromUser();
int usersChoice = Integer.parseInt(choices[0]);
switch (usersChoice)
{
case 1: // then …Run Code Online (Sandbox Code Playgroud) 我是Java的新手,并且正在使用GUI显示消息.所以如果使用控制台
System.out.printf("Your total montly bill is $%.2f", totalCost);
Run Code Online (Sandbox Code Playgroud)
给我输出十进制的方式.我试图用这个做同样的事情,但是我得到更多的十进制数字,因为totalCost是一个类型double.如何将输出格式化为仅在小数后显示两位数?谢谢.
JOptionPane.showMessageDialog(null, "Your monthly payment is " + totalCost);
Run Code Online (Sandbox Code Playgroud) 我有一个包含两列'id'和'layout plan'的表
我需要查看具有相同布局规划的所有行
我用这个查询.
select *
from project_layout
group by layout_plan
having count(layout_plan) > 1
Run Code Online (Sandbox Code Playgroud)
但是这个查询只返回第一行.
我想看到所有具有相同布局规划的组.
我创建了一个扩展JFrame的类,默认情况下会使用它创建一个JPanel.我试过这个:
public class Main extends JFrame {
JPanel pane;
private static final long serialVersionUID = 1L;
public Main() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int WIDTH = 500, HEIGHT = 500;
setBackground(Color.LIGHT_GRAY);
setSize(WIDTH, HEIGHT);
setTitle("Window");
setLocationRelativeTo(null);
pane = getContentPane();
}
Run Code Online (Sandbox Code Playgroud)
我正在使用Eclipse,并且它给出了一个错误,建议我转换getContentPane()为返回a JPanel,但根据我的理解,这应该是它应该返回的内容.我插入System.out.println(getContentPane());并在控制台中说它返回了一个JPanel,所以我有点困惑为什么它需要被投射.这里有什么我想念的吗?谢谢.