Featured Post

Wednesday, May 10, 2017

Java program to print numbers and names using System class and concatenation operator


class printdemo    /*printdemo.java*/
{
  public static void main(String args[])
  {
    int a=5;
    String str="ashok"; /* String is predefined class in java */
    System.out.println("value of a is "+a);
    System.out.println("name is "+str);
   }
}

output:
D:\cjuschools>javac printdemo.java
D:\cjuschools>java printdemo
value of a is 5
name is ashok

/*key notes: in System.out.println statement we use a + operator(stands for concatenation)*/
/*  in first output statement we are appending value of a to string value of a is*/
/*in second output statement we are appending str value to name is*/


                                                      Next


oops through java,inheritance,interface,package,super keyword, program demonstrating the use of super keywork,abstract class, static, main,awt, swings,jtab, layout,panel,applet,param,Frame,JFrame, swingutilities.invokeLater,swingutilities.invokeanwait,multithreading,multiprocesing,start(),init() paint(),adapter class,inner class,annonymous inner class,outer class,packages,friendly, constrcutors,destructors,garbage collector, inheritance, encapusulation,abstraction,bytecode,
compiler,interpreter,jdbc,jsp pages,exception handling

No comments:

Post a Comment