Sunday 18 January 2015

PART II : Know the Value of Variables : CHARLES AND JACK STORY

                                            Making the Most of Variables
                                and Their Values



▶ Assigning values to things

▶ Making things store certain types of values

▶ Applying operators to get new values


                        READ THE BELOW                                                    CONVERSATION 

The following conversation between Mr. Van Doren and Mr. Barasch never
took place:
Charles: A sea squirt eats its brain, turning itself from an animal into a plant.

Jack: Is that your final answer, Charles?
Charles: Yes, it is.

Jack: How much money do you have in your account today, Charles?

Charles: I have fifty dollars and twenty-two cents in my checking account.

Jack: Well, you better call the IRS, because your sea squirt answer is
correct. You just won a million dollars to add to your checking account.

What do you think of that, Charles?
Charles: I owe it all to honesty, diligence, and hard work, Jack.


Some aspects of this dialogue can be represented in Java by a few lines of code.







what you can do with a Language - Java

                                                            YES I CAN DO IT  


It would be so nice if all this complexity was free, but unfortunately, it isn't.
Someone has to think hard and decide exactly what to ask the computer to
do. After that thinking, someone has to write a set of instructions for the
computer to follow.

Given the current state of affairs, you can’t write these instructions in English
or any other language that people speak. Science fiction is filled with stories
about people who say simple things to robots and get back disastrous, unexpected
results. English and other such languages are unsuitable for communication
with computers for several reasons:



✓ An English sentence can be misinterpreted. “Chew one tablet three
times a day until finished.”
✓ It’s difficult to weave a very complicated command in English. “Join
flange A to protuberance B, making sure to connect only the outermost
lip of flange A to the larger end of the protuberance B, while joining the
middle and inner lips of flange A to grommet C.”
✓ An English sentence has lots of extra baggage. “Sentence has
unneeded words.”
✓ English is difficult to interpret.



class PayBarry {


public static void main(String args[]) {
double checkAmount = 1257.63;
System.out.print(“Pay to the order of “);
System.out.print(“Dr. Barry Burd “);
System.out.print(“$”);
System.out.println(checkAmount);

         }


}


Thursday 8 January 2015

Checking Out Java Code for the First Time

The first time you look at somebody else’s Java program, you tend to feel a bit
queasy. The realization that you don’t understand something (or many things)
in the code can make you nervous. I’ve written hundreds (maybe thousands) of
Java programs, but I still feel insecure when I start reading someone else’s code.
The truth is that finding out about a Java program is a bootstrapping experience.
First, you gawk in awe of the program. 


Then you run the program to see
what it does. Then you stare at the program for a while or read someone’s
explanation of the program and its parts. Then you gawk a little more and run
the program again. Eventually, you come to terms with the program. (Don’t
believe the wise guys who say they never go through these steps. Even the
experienced programmers approach a new project slowly and carefully.)
In Listing 3-1, you get a blast of Java code. (Like all novice programmers,
you’re expected to gawk humbly at the code.) Hidden in the code, I’ve placed
some important ideas, which I explain in detail in the next section. These
ideas include the use of classes, methods, and Java statements.



The Simplest Java Program


class Displayer {

public static void main(String args[]) {

System.out.println(“You’ll love Java!”);

}


}


Tuesday 6 January 2015

Not just English is One Language .. People found out even a Language to Communicate with Non Living things " Write Once, Run Anywhere "

Getting Perspective: Where Java Fits In


Here’s a brief history of modern computer programming:
✓ 1954–1957: FORTRAN is developed.
FORTRAN was the first modern computer programming language. For
scientific programming, FORTRAN is a real racehorse. Year after year,
FORTRAN is a leading language among computer programmers throughout
the world.

✓ 1959: COBOL is created.
The letter B in COBOL stands for Business, and business is just what
COBOL is all about. The language’s primary feature is the processing of
one record after another, one customer after another, or one employee
after another.

Within a few years after its initial development, COBOL became the most
widely used language for business data processing. Even today, COBOL
represents a large part of the computer programming industry.

✓ 1972: Dennis Ritchie at AT&T Bell Labs develops the C programming
language.
The “look and feel” that you see in this book’s examples comes from
the C programming language. Code written in C uses curly braces, if
statements, for statements, and so on.
In terms of power, you can use C to solve the same problems that you
can solve by using FORTRAN, Java, or any other modern programming
language. (You can write a scientific calculator program in COBOL,
but doing that sort of thing would feel really strange.) The difference
between one programming language and another isn’t power. The
difference is ease and appropriateness of use. That’s where the Java
language excels.

✓ 1986: Bjarne Stroustrup (again at AT&T Bell Labs) develops C++.
Unlike its C language ancestor, the language C++ supports object oriented
programming. 

✓ May 23, 1995: Sun Microsystems releases its first official version of the
Java programming language.
Java improves upon the concepts in C++. Java’s “Write Once, Run
Anywhere” philosophy


Part I Getting Started

                                                             All about Java



What You Can Do with Java

It would be so nice if all this complexity was free, but unfortunately, it isn't.

Someone has to think hard and decide exactly what to ask the computer to
do. After that thinking, someone has to write a set of instructions for the
computer to follow.

Given the current state of affairs, you can’t write these instructions in English
or any other language that people speak. Science fiction is filled with stories
about people who say simple things to robots and get back disastrous, unexpected
results. English and other such languages are unsuitable for communication
with computers for several reasons:
✓ An English sentence can be misinterpreted. “Chew one tablet three
times a day until finished.”
✓ It’s difficult to weave a very complicated command in English. “Join
flange A to protuberance B, making sure to connect only the outermost
lip of flange A to the larger end of the protuberance B, while joining the
middle and inner lips of flange A to grommet C.”
✓ An English sentence has lots of extra baggage. “Sentence has
unneeded words.”