
How do I write a program in Java, have the program display a message with your name in it and a number (Hello john Smith!1) The number must increment from zero to nine, or decrement fron nine to zero. You must use a "while" loop or a "for Loop". In other words you cannot simply type ten contiguous output statement. For example your output cuold be something like this: Hello John Smith!9 Hello John Smith!8 Hello John Smith!7 Hello John Smith!6 Hello John Smith!5 Hello John Smith!4 Hello John Smith!3 Hello John Smith!2 Hello John Smith!1 Hello John Smith!0

import java.util.*;
class AcceptName
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("Enter name: ");
String name=input.nextLine();
String mess="Hello";
for(int i=9;i>=0;i--){
System.out.println(mess+" "+name+"!"+i);
}
}
}

import java.io.*;
class sample
{
public static void main(String args[])throws Exception
{
DataInputStream in=new DataInputStream(System.in);
System.out.println("Enter the Name");
String name=in.readLine();
for(int i=0;i<10;i++)
{
System.out.println(name + " " + i);
}
}
}


Write a program to read 20 number from user and print the maximum and minimum number.

class x
{
protected void fun()//declare only protected or public not private
{
System.out.println("Base class");
}
}
class y extends x
{
public void fun()//in this case if we declare base class constructor is private then child class constructor may be private or public But if declare base constructor is as public then child class must be public
{
System.out.println("child class");
}
}
public class Dynamicmethod
{
public static void main(String[] args)
{
x ab=new y();
ab.fun();
}
}
//o/p is child cass
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.