和野码哥实训Day 1

import java.io.IOException;

public class Hello{
    public static void main (String[] args) throws IOException {

        System.out.println("欢迎使用自动关机程序");
        Runtime.getRuntime().exec("shutdown -s -t");
        System.out.println("家人,你的电脑将在3600秒后关机");
    }
}

import java.io.IOException;

public class Hello{
    public static void main (String[] args) throws IOException {

        System.out.println("欢迎使用自动关机程序");
        Runtime.getRuntime().exec("shutdown -a");
        System.out.println("家人,你的电脑取消关机了");
    }
}
 

21a814e907ca4f46814d1b7a79fd0bd3.png

665d5daa64544db090e1b7cff4d71fdd.png

 package TestDemo;
public class TestDemo02 {
    public static void main(String[] args) {
        int age = 18;
        System.out.println("age: " + age);
        System.out.println("=");
        String name = "xxx";
        System.out.print1n("name: " + name);
    }
}

public class Hello {
    public static void main(String[] args) throws IOException{

/* public:公有的,权限修饰
* class: Java中的关键字,用来修饰一个类
*Hello:是类名
/*
System.out.println("Hello world!");
**/
/*static:关键字,表示静态的
/*void:关键字,没有返回值类型
/*main:表示主方法名 是Java程序入口
       // (String[] args):表示形参变量 String类型的数组 args 是形参变量名
//编程打印你的姓名,专业,座有铭
        System.out.println("我的名字叫赫,我的专业是软件工程,我的座右铭是真爱不解释");
       //变量在使用前
        int age=18;
//变量在使用前必须初始化
        System.out.printlnn("age="+age);
//变量不能够重复定义
    }
}

public class VariableDemo02 {
    public static void main(String[] args) {
//1.由数字,下划线,$组成,数字不能开头
        int num = 23;
//2.长度没有限制,但不易过长
        bkdbv = 9;//int fuaiskbljkfbkdbv
//System.out.println(fuaiskbljkfbkdbv);
//3.不能使用java中的关键字和保留字
//Stringvoid = "dja";
                .经量做到见名知意,可以用中文,但不推荐
        String姓名=小王
        System.out.println(姓名);
    }
}

  • 8
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值