java代码一览图 java代码长什么样

求Java代码的含义:图中划有红线的".get(2)"和"1"分别代表什么意思states应该是一个List,调用get(2)取出第3个元素 。
scheduleAtFixedRate
ScheduledFuture? scheduleAtFixedRate(Runnable command,
long initialDelay,
long period,
TimeUnit unit)
创建并执行一个在给定初始延迟后首次启用的定期操作,后续操作具有给定的周期;也就是将在 initialDelay 后开始执行,然后在
initialDelay+period 后执行 , 接着在 initialDelay + 2 * period
后执行 , 依此类推 。如果任务的任一执行遇到异常,都会取消后续执行 。否则,只能通过执行程序的取消或终止方法来终止该任务 。
参数:
command - 要执行的任务 。
initialDelay - 首次执行的延迟时间 。
period - 连续执行之间的周期 。
unit - initialDelay 和 period 参数的时间单位 。
java代码,最好有运行图片public class Test{
public static void main(String[]args){
java.util.Scanner s = new java.util.Scanner(System.in);
System.out.println("input a");
int a = s.nextInt();
System.out.println("input b");
int b = s.nextInt();
System.out.println("input c");
int c = s.nextInt();
calcSqrt(a, b, c);
}
public static void calcSqrt(int a, int b, int c){
System.out.println("first result: "
+ ((-b + java.lang.Math.sqrt(b*b - 4*a*c))/(2*a)));
System.out.println("sencond result: "
+ ((-b - java.lang.Math.sqrt(b*b - 4*a*c))/(2*a)));
}
}
执行结果:
input a
1
input b
5
input c
6
first result: -2.0
sencond result: -3.0
有没有java代码详细解释图片这个就是求1的阶乘+2的阶乘加3的阶乘一直加到你传入的参数的阶乘
就是用递归实现的代码很少
登录界面的java代码,分别有教师登录,管理员登录,学生登录,右边是用户名和密码,见图 。分三个包,自己建个包,导进去就ok了,数据库是access的 。
package 登录;
import java.awt.EventQueue;
public class Cilent {
private JFrame frame;
private JTextField textField;
private JPasswordField passwordField;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Cilent window = new Cilent();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Cilent() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("登陆界面");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
frame.setResizable(false);
JLabel lblNewLabel = new JLabel("用户名");
lblNewLabel.setBounds(38, 43, 80, 34);
frame.getContentPane().add(lblNewLabel);
textField = new JTextField();
textField.setBounds(155, 42, 227, 37);
frame.getContentPane().add(textField);
textField.setColumns(10);
JLabel label = new JLabel("密 码");
label.setBounds(38, 115, 80, 34);
frame.getContentPane().add(label);
passwordField = new JPasswordField();
passwordField.setBounds(155, 115, 227, 37);
frame.getContentPane().add(passwordField);
JButton btnNewButton = new JButton("登 录");
btnNewButton.setBounds(60, 187, 115, 34);
frame.getContentPane().add(btnNewButton);
btnNewButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {

推荐阅读