Computer Science, asked by ashwin41566, 4 months ago

Write a java program to print Good Morning On Screen.
. [Initialization of Variables]​

Answers

Answered by derenamanjha1234
2

private void getTimeFromAndroid() {

       Date dt = new Date();

       int hours = dt.getHours();

       int min = dt.getMinutes();

       if(hours>=1 || hours<=12){

           Toast.makeText(this, "Good Morning", Toast.LENGTH_SHORT).show();

       }else if(hours>=12 || hours<=16){

           Toast.makeText(this, "Good Afternoon", Toast.LENGTH_SHORT).show();

       }else if(hours>=16 || hours<=21){

           Toast.makeText(this, "Good Evening", Toast.LENGTH_SHORT).show();

       }else if(hours>=21 || hours<=24){

           Toast.makeText(this, "Good Night", Toast.LENGTH_SHORT).show();

       }

   }

Answered by anindyaadhikari13
9

Question:-

Write a program in Java to display Good Morning on the screen.

Program:-

This is a very simple program. Check it.

class Print

{

public static void main()

{

System.out.print("Good Morning.");

}

}

Similar questions