Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Sunday, December 10, 2017

Java Basic 001

A Simple Java Program


Let us being with java program that displayed the message “welcome to java….!!” on the console.



Every Java programmer must have at least one class. A class is a construct that defines data and methods. Each class has a name. By convention, class names start with an upper case latter. In this example, the class name is Welcome.
In order to run a class, the class must contain a method named main. The JVM executes the program by invoking the main method. A method is construct that contains statements. The main method in this program contains the System.out.pritln statement. This statement prints a message “Welcome to Java…!!”  to the console.

Creating, Compiling, and Executing the Java Program 


You have create your program and compile it before it can be executed. This process is repetitive, as shown in above Figure. if your program has compilation errors, you have to fix them by modifying the program, and then recompile it. If your program has runtime errors or does not produced the correct result, you have to  modifying the program, recompile it, and execute it again.

You can use any text editor to create and edit a java source code file, or you can use an IDE like JCreator , Eclipse , JBuilder or NetBeans.



This file must end with the extension .java and must have the exact same name as the public class name. For example, the file for the source code in above image should be named Welcome.java , since the public class name is Welcome.

A Java compiler translates a Java source file into a Java bytecode file. The following command compiles Welcome.java:

Javac Welcome.java 


If there are no syntax errors, the compiler generates a bytecode file with a .class. the bytecode is similar to machine instructions but is architecture-neutral and can run on any platform that has a JVM. This is one of Java's primary advantages: Java bytecode can run on a variety of hardware platform and operating systems.

To execute a java program is to run the program's bytecode. You can execute the bytecode on any platform with a JVM. The following command runs the bytecode

java Welcome 






Saturday, December 9, 2017

PROGRAMMER

WHO IS A P PROGRAMMER?


You've probably used a computer to do word processing. Type a letter, print it out, and then send the printout to someone you love. If you have easy access to a computer, then you've probably surfed the web. Visit a page, click a link, and see another page.It's easy , right ?

well, it's only because some one told the computer exactly what to do.If you take a computer right from the factory and give no instruction to this computer , the computer can't do word processing ,the computer can't surf the web, it can't do anything. All a computer can do is follow the instructions that people give to it.

Now imagine that you're   using Microsoft word to write a novel or story, and you come to the end of line ( you'r not at the end of sentence, just end of line). As you type the next word , the computer's cursor jumps automatically to the next line of type. What's going on here ?

Well, someone wrote a computer program - a set of instructions telling the computer what to do. Another name for a program ( or part of program) is code. The figure below shows you what some of Microsoft Word's code may look like.

A few lines of a computer program


Somebody has to write code of the kind shown above. This code,along with millions of other lines of code, makes up the program called Microsoft word.

And what about Web surfing? You click a link that's supposed to take you directly to 26stream.blogspot.com. Behind the scenes, someone has written code of the following kind:
      Go to<a href=http://www.26stream.blogspot.com>26stream</a>

One way or another, someone has to write a program. That someone is called a programmer.
   

  

How many application installed on Linux

Identify all Linux codes that accessible from terminal https://www.youtube.com/watch?v=p6VGmXlTEYs