Pages

Showing posts with label languages. Show all posts
Showing posts with label languages. Show all posts

Friday 28 June 2013

what is system.out.println() in java language???

system.out.println():
                system is predefined class which is available in java.lang predefined package.
                                       out is a static reference varaiable of system class,which represnts the object of print stream class
println():
           println is a non static method which is present inside print stream class
printstream():
            printstream is a pre defined class which is available in java.io predefined package
  class system
  {
    static print stream out=new printstream();
     }

class printstream()                                            
{
   void println()
    {
       ------------
        --------------
     }
  void print()
{
  ------------
      -------------
}
void printf()
{
 --------------
----------------
}
}


WHAT IS JAVA? WHY JAVA PLATFORM INDEPENDENT???

WHAT IS JAVA:
           java is a object oriented,platform independent programming language from sun micro system which is released into the marked on the name of development of the distributed applications.
object oriented:
                 the languages which are implementing the OOPS principles are called as object oriented programming language(OOPL)
first known the platform
what is platform:
operating system+architecture of processor together is known as plotform
platform independent:
anything which is not specific to that platform is known as platform independent
the compile code of the any programmng language would be executed irrespectives of platform under
which has been developed then those programming language are called platorm independent.best example java language
HOW TO ACHIEVE TO PLATFORM INDEPENDENCY IN JAVA:
we can achieve the platform independency in java by using jvm.
what is JVM(java virtual machine):
jvm is a collection of programs.the functionality of the jvm is it will convert the byte code in the form of machine
understanle format
note:jvm is a platform dependent because jvm is specific to each and every os.

Monday 20 May 2013

C LANGUAGE INTRODUCTION

The only way to learn a new programming language is by writing programs in it. The first program to write is the same for all languages:
Print the words:hello, world

In C, the program to print ``hello, world'' is
#include
main()
{
printf("hello, world\n");

}
Just how to run this program depends on the system you are using. 

complie the program click the alt+F9.and dispaly errors and warning.errors and warnings must be zero and next run the program click ctrl+F9 to display the output
As a specific example, on the UNIX operating system you must create the program in a file whose name ends in ``.c'', such as hello.c, then compile it with
the command
cc hello.c
If you haven't botched anything, such as omitting a character or misspelling something, the compilation will
proceed silently, and make an executable file called a.out. If you run a.out by typing the command
a.out
it will print
hello, world

ANOTHER EXAMPLE:
An example of simple program in C
#include
int main(void)
{
          printf(“HAI HOW ARE YOU\n”);
          printf(“FINE ”);
          printf(“you know the trick\n”);
          return(0);
 
The previous program will produce the following output on your screen 
 HAI HOW ARE YOU
 FINE you know the trick
 
a C program line begins with # provides an instruction to the C preprocessor
It is executed before the actual compilation is done.
Two most common directives :
#include
#define 
In our example (#include) identifies the header file for standard input and output needed by the printf().
 
Identify the start of the program
Every C program has a main ( )
'main' is a C keyword.  We must not use it for any other variable
 
Identify a segment / body of a program
The start and end of a function
The start and end of the selection or repetition block.
Since the opening brace indicates the start of a segment with the closing brace indicating the end of a segment, there must be just as many opening braces as closing braces  (this is a common mistake of beginners) 
 
Each statement in C needs to be terminated with semicolon (;) 

Each statement in C needs to be terminated with semicolon (;)