Starting with comments

08:47 Unknown 0 Comments


·         Starting with details of our java programming structure.
·         First is comments.
·         Comments are used in programming for textual description of code.
·         Comments are always ignored by compiler.
·         Writing comments in programming is optional but for our better understanding of we are writing.
·         Comments are of three types and they are

ü  Single line comments
Syntax:    //-----------------------------------

ü  Multiple line comments
Syntax:             /*-------------------
-----------------*/

ü  Documentation comments
Syntax:      /**----------------
          -------------------
          -------------------*/


Program:
 

0 comments:

Declaration of Java file

08:44 Unknown 0 Comments


·         Starting with our source file of java in which we are writing our java code.
·         Java source file saved with .java extension.
·         Some rules while declaring the source file as follows,

ü  A source file can have only one public class.
ü  Source file can have any number of non-public classes
ü  If the source file contains public class then file name must match with public class name.
ü  If the source file does not contain public class then there is no naming restrictions to file name.
Example
1)      X.java

public Class X
{
===========              
}
3)      Y.java

public Class Y
{
============          
}
2)        Z.java

Class A
{
========                 
}

Class B
{
========
}

4)      R.java

 Class Z
{
============
}

 Class Y
{
=============
}

NOTE: For every source file of java .class file will be generated.

0 comments:

Introducing programming structure of JAVA

08:42 Unknown 0 Comments

·         Basically we are learning java through programming but for understanding we are defining some terms in Java.
·         So starting small history Java was developed in 1995 by James Gosling and three more at Sun Micro systems but now it is owned by Oracle Corporation.
·         Now starting with our programming manner structure of Java Program…

Structure of JAVA Program

//Program for test
Import java.lang.*;
Class Test
{
                /**
                @author Student
                **/
                public static void main(String argd[])
                {
                                System.out.println(“---------Test----------”);
                }
}

Starting with every programming language we have seen ‘Hello World’ program but behind every program what actually is we will be looking for that.

Now in above program,
·         “//” Comments
·         “import”  is keyword.
·         “java”   is package.
·         lang” is sub package
·         “*” represents all classes and interfaces in that package
·         “Class” is also keyword.
·         “Test”  is identifier(Name of class).
·         “ public“ is access modifier.
·         “static “ is modifier.
·         “void“ is return type of main method.
·         “String” is predefined class.
·         “args[]“ is array of object reference.
·         “System” is library class.
·         “out” is object reference.
·         “println” is predefined method.
·         “-------Test---------” is string literal.


So this is only we have introduced in program what is but what is actual functionality of each we will be learning in next sessions…

0 comments:

IBM Cloud Social and Mail

05:15 Unknown 0 Comments

0 comments:

Cloud Computing: What is Cloud Computing?

05:08 Unknown 0 Comments

0 comments: