Traditional Culture Encyclopedia - Weather inquiry - How to use web service to realize automatic updating of weather forecast newspapers on asp pages?

How to use web service to realize automatic updating of weather forecast newspapers on asp pages?

One. The first is the method class:

Public class method {

//The parameter is the letter entered.

Public void print weather (string input char)

{

//Displays the entered letters.

if(input char . equalsignorecase(" d "))

{

system . out . println(" dry ");

}

if(input char . equalsignorecase(" m "))

{

system . out . println(" wet ");

}

if(input char . equalsignorecase(" h "))

{

system . out . println(" hot ");

}

if(input char . equalsignorecase(" r "))

{

system . out . println(" rain ");

}

other

{

System.out.println ("input error");

}

}

}

Two. Followed by the execution class:

Import java.util. *;

Common class test {

Public static void main(String[] args) {

Scanner input = new scanner (system. in);

String weather =

String answer = "";

Method method = newmethod ();

do

{

System.out.println ("Please enter the first letter (d, m, h, r)");");

//Receive the entered weather.

Weather = input.next ();

//Call the method, passing in parameters.

Method.printWeather (weather);

System.out.println ("Do you want to continue typing?" );

//Whether the reception is input as n

The answer = input.next ();

}while(! answer . equalsignorecase(" n "));

}

}