Home > database >  Public class Helloworld {public static void main (String [] args)
Public class Helloworld {public static void main (String [] args)

Time:10-01


Public class Helloworld
{
Public static void main (String [] args)

{the HelloWorld hello=new HelloWorld (); Int maxScore=hello. GetMaxAge ();

System. The out. Println (" biggest age was: "+ maxScore);

Public int getMaxAge () {

Int [] which=(18 and 23, 21, 19, 25, 29, 17). Int Max=which [0];

Int len=which. Length;

for(int i=0; I & lt; Len. I++)
{

If (Max & lt; Which [I])

Max=which [I];

The return of Max;
}

}


Public class HelloWorld
{
Public static void main (String [] args) {
Int num=999; int count=0;

If (num> 0 & amp; & Num<1000000000 {
While (num!=0) {
count++; Num/=10;

System. Out.println (" it is a "+ count + a few!" ");
The else
System. The out. Print1n (" input is wrong! ");

}
}

The class Animal {
Public void eat () {
System. The out. Println (" animals have the ability to eat ");
}
}
The class Dog extends Animal {
Public void eat () {
System. The out. Print1n (" dog is eating meat ");
The class the Cat extends
Animal {
}
The class Main {
Public static void main (String [] args) {
Animal obj1=new Animal ();
Animal obj2=new Dog ();
Animal obj3=new (Cat);
Obj1. Eat ();
Obj2. Eat ();
Obj3. Eat ();
}
}



Public class Helloworld
{
Public static void main (string [] args)
{int x=3;
For (int I=1; I<=x; I++)
For (intj=1; J<=x - I; J++)
System. The out. Print (" ");
For (intj=1; J<=2 * I - 1; J++)
System. The out. Print (" * ");
System. The out. Println (); ]
For (int I=x - l; I & gt; 0; I -)
For (intj=1; J & lt;=x - I; J++)
System. The out. Print (" ");
for(int j=1; J<=2 * I - 1; J++)
System. The out. Print (" * ");
System. The out. Println ();
  • Related