D:\JAVA 9.6\java 安装jdk和jre 配置path环境
#include<iostream>
using namespace std;
class A
{
public:A()
{
hour=0;
sec=0;
minute=0;
}
void set_time();
void show_time();
private:
int hour;
int minute;
int sec;
};
void A::set_time()
{cin>>hour;
cin>>minute;
cin>>sec;
}
void A::show_time()
{cout<<hour<<":"<<minute<<":"<<sec<<endl;}
int main()
{
A a;
a.set_time();
a.show_time();
A b;
b.show_time();
system("pause");
return 0;
}
public class Hello {
public static void main (String args[]) {
System.out.printIn("this is a program");
Student stu= new Student();
stu.speak("We are students");
}
}
class Student{
public void speak (String s)
{ System.out.printIn(s);
}
}