我对我的程序唯一的问题是扫描仪,我已经多次使用它但是在这个程序中它将无法正常运行。错误在public static double getCandlecost()和public static int getShippingType()方法中。在int shippingType = sc.nextInt()下;和double candleCost = sc.nextDouble();两人都说“sc无法解决”,而在我的主要课程中我确实声明了它。
import tkMessageBox
from Tkinter import *
def show_entry_fields():
# print("Nombre : %s\nApellido: %s" %(e1.get(), e2.get()))
if e1.get() == 'ivan' and e2.get() == '123456':
tkMessageBox.showinfo(message="Bienvenido Ivan")
else:
print "Usuario Incorrecto..."
master = Tk()
Label(master, text="Nombre").grid(row=0)
Label(master, text="Apellido").grid(row=1)
e1 = Entry(master)
e2 = Entry(master, show="*")
e1.insert(10, "Jonas")
e2.insert(10, "reyes")
e1.grid(row=0, column=1)
e2.grid(row=1, column=1)
Button(master, text='Quit', command=master.quit).grid(row=3, column=0, sticky=W, pady=4)
Button(master, text='Show', command=show_entry_fields).grid(row=3, column=1, sticky=W, pady=4)
mainloop()
答案 0 :(得分:1)
您的扫描仪超出范围。由于您已在public class Candel {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
...
}
...
}
方法中声明了它,因此只有该方法才能访问它。您的扫描仪也需要是静态的。这样写它:
CREATE VIEW view_1 AS
SELECT col1,col2,col3,null as col4,null as col5 FROM tableA
UNION ALL
SELECT col1,col2,col3,col4,col5 FROM tableB
;