Thursday, 28 November 2013

What is a File?



Abstractly, a file is a collection of bytes stored on a secondary storage device, which is generally a disk of some kind. The collection of bytes may be interpreted, for example, as characters, words, lines, paragraphs and pages from a textual document; fields and records belonging to a database; or pixels from a graphical image. The meaning attached to a particular file is determined entirely by the data structures and operations used by a program to process the file. It is conceivable (and it sometimes happens) that a graphics file will be read and displayed by a program designed to process textual data. The result is that no meaningful output occurs (probably) and this is to be expected. A file is simply a machine decipherable storage media where programs and data are stored for machine usage.

Essentially there are two kinds of files that programmers deal with text files and binary files.

ASCII Text files :

A text file can be a stream of characters that a computer can process sequentially. It is not only processed sequentially but only in forward direction. For this reason a text file is usually opened for only one kind of operation (reading, writing, or appending) at any given time.

Similarly, since text files only process characters, they can only read or write data one character at a time. (In C Programming Language, Functions are provided that deal with lines of text, but these still essentially process data one character at a time.) A text stream in C is a special kind of file. Depending on the requirements of the operating system, newline characters may be converted to or from carriage-return/linefeed combinations depending on whether data is being written to, or read from, the file. Other character conversions may also occur to satisfy the storage requirements of the operating system. These translations occur transparently and they occur because the programmer has signalled the intention to process a text file.

Binary files :

A binary file is no different to a text file. It is a collection of bytes. In C Programming Language a byte and a character are equivalent. Hence a binary file is also referred to as a character stream, but there are two essential differences.

   1. No special processing of the data occurs and each byte of data is transferred to or from the disk unprocessed.
   2. C Programming Language places no constructs on the file, and it may be read from, or written to, in any manner chosen by the programmer.

Binary files can be either processed sequentially or, depending on the needs of the application, they can be processed using random access techniques. In C Programming Language, processing a file using random access techniques involves moving the current file position to an appropriate place in the file before reading or writing data. This indicates a second characteristic of binary files.
They a generally processed using read and write operations simultaneously.

For example, a database file will be created and processed as a binary file. A record update operation will involve locating the appropriate record, reading the record into memory, modifying it in some way, and finally writing the record back to disk at its appropriate location in the file. These kinds of operations are common to many binary files, but are rarely found in applications that process text files.

C supports a number of functions that have the ability to perform basic file operations, which include:

1. Naming a file
2. Opening a file
3. Reading from a file
4. Writing data into a file
5. Closing a file 

   Real life situations involve large volume of data and in such cases, the console oriented I/O operations pose two major problems. It becomes cumbersome and time consuming to handle large volumes of data through terminals. The entire data is lost when either the program is terminated or computer is turned off therefore it is necessary to have more flexible approach where data can be stored on the disks and read whenever necessary, without destroying the data. This method employs the concept of files to store data.

File operation functions in C:

Function Name Operation

fopen() Creates a new file for use
Opens a new existing file for use

fclose() Closes a file which has been opened for use

getc() Reads a character from a file

putc() Writes a character to a file

fprintf() Writes a set of data values to a file

fscanf() Reads a set of data values from a file

getw() Reads a integer from a file

putw() Writes an integer to the file

fseek() Sets the position to a desired point in the file

ftell() Gives the current position in the file

rewind() Sets the position to the begining of the file


1. Defining and opening a file :

If we want to store data in a file into the secondary memory, we must specify certain things about the file to the operating system. They include the fielname, data structure, purpose.

The general format of the function used for opening a file is

FILE *fp;
fp=fopen(“filename”,”mode”);

The first statement declares the variable fp as a pointer to the data type FILE. As stated earlier, File is a structure that is defined in the I/O Library. The second statement opens the file named filename and assigns an identifier to the FILE type pointer fp. This pointer, which contains all the information about the file, is subsequently used as a communication link between the system and the program.
The second statement also specifies the purpose of opening the file. The mode does this job.

R open the file for read only.
W open the file for writing only.
A open the file for appending data to it.

Consider the following statements:

FILE *p1, *p2;
p1=fopen(“data”,”r”);
p2=fopen(“results”,”w”);

In these statements the p1 and p2 are created and assigned to open the files data and results respectively the file data is opened for reading and result is opened for writing. In case the results file already exists, its contents are deleted and the files are opened as a new file. If data file does not exist error will occur. 

2. Closing a file :

The input output library supports the function to close a file; it is in the following format.

fclose(file_pointer); 

A file must be closed as soon as all operations on it have been completed. This would close the file associated with the file pointer.
Observe the following program.

….
FILE *p1 *p2;
p1=fopen (“Input”,”w”);
p2=fopen (“Output”,”r”);
….
fclose(p1);
fclose(p2)

The above program opens two files and closes them after all operations on them are completed, once a file is closed its file pointer can be reversed on other file.

The getc and putc functions are analogous to getchar and putchar functions and handle one character at a time. The putc function writes the character contained in character variable c to the file associated with the pointer fp1. ex putc(c,fp1); similarly getc function is used to read a character from a file that has been open in read mode. c=getc(fp2). 

The getw and putw functions :

These are integer-oriented functions. They are similar to get c and putc functions and are used to read and write integer values. These functions would be usefull when we deal with only integer data. The general forms of getw and putw are:

putw(integer,fp);
getw(fp);

The fprintf & fscanf functions :

The fprintf and fscanf functions are identical to printf and scanf functions except that they work on files. The first argument of theses functions is a file pointer which specifies the file to be used. The general form of fprintf is

fprintf(fp,”control string”, list);

Where fp id a file pointer associated with a file that has been opened for writing. The control string is file output specifications list may include variable, constant and string.

fprintf(f1,%s%d%f”,name,age,7.5);

Here name is an array variable of type char and age is an int variable
The general format of fscanf is

fscanf(fp,”controlstring”,list);

This statement would cause the reading of items in the control string. 

Random access to files :

Sometimes it is required to access only a particular part of the and not the complete file. This can be accomplished by using the following function:

1 > fseek

fseek function :

The general format of fseek function is a s follows:

fseek(file pointer,offset, position);

This function is used to move the file position to a desired location within the file. Fileptr
is a pointer to the file concerned. Offset is a number or variable of type long, and position in an integer number. Offset specifies the number of positions (bytes) to be moved from the location specified bt the position. The position can take the 3 values.

Value Meaning
0 Beginning of the file
1 Current position
2 End of the file. 


 C.

-- 
Regards,

Preeti Bagad [BE(CS)] 
SW Engineer Cum Blogger

On Line Assistence :
Y! Messenger : PreetiB.A1Soft@yahoo.com

Meta Tags Optimization





 There used to be a time when the contents of a pages Meta Tags was very important, it was around about the same time the Berlin Wall was still standing!! Today meta tags hold little value to Search Engine Optimization (SEO).
What Are Meta Tags? Way, way back when that wall was still upright search engine algorithms were so dumb they couldn’t work out what a page was about just from the content. So some bright spark had the ingenious idea to create a set of tags (meta tags) that inferred information about a pages content to the search engines.

Meta tags are lines of HTML code added into web pages that are utilized by search engines to bank information about your website. The standard Meta Tags are the keyword Meta Tag, the description Meta Tag, and the Title tag, which exist in approximately every web page. These Meta Tags, oftenly called as 'Tags', store meta data including keywords, keyphrases, descriptions, site author information, copyright information, site titles and other details. There are other important Meta Tags as well, which is why Meta tag optimization must be part of any web site optimization service. Meta Tags are among the several factors that the search engines look for, that any search engine optimization strategy needs to keep on top of.





Meta tags are incorporated in the 'HEAD' Tag of an HTML document. If you are using meta tags to Boost your Rankings in search engines, then you should concentrate on your description and keywords. Great idea, except there was nothing to stop a webmaster stuffing or spamming their Meta Tags with irrelevant, but very high traffic keywords and keyword phrases. Which of course they did with enthusiasm, you would find adult sites using words like Disney and Pokemon in their Keywords Meta Tag for the traffic!! Today the vast majority of meta tags are worthless and those that are still considered by search engines aren’t worth that much. For example Google confers no benefit from any meta tags, so if you expect a high Google ranking from perfectly optimised keywords in your meta tags, don’t hold your breath.



Which Meta Tags Should You Use?

For Google adding the Description Meta Tag won’t result in a boost in the Search Engine Results Pages (SERPs), but the description might be used for the description for your SERP listings in Google. So though you won’t get a ranking boost, if your write an interesting Description Meta Tag and Google uses it (not guaranteed), you might get a higher click through rate compared to a random snippet of text from your pages. All other meta tags (including the Keywords Meta Tag) are either completely ignored or won’t result in a SERPs boost.

Yahoo says they use the Keyword Meta Tag when it ranks a page. So it makes sense to add one for Yahoo and any other minor search engines that still use. Also there are directories and other websites that automatically take this information to create a listing to your site. Don’t fret over it though, add the main phrase for that page to the Keywords Meta Tag and user friendly description of the page to the Description Meta Tag and forget about it.

Use the title tag and description tag to define what your page signifies. Search engines that use it will supply the content of title tag and description tag while displaying a list of links. For example, if you do a search on Google, you will find the description listed on the search results page.

The keywords tag :

Keywords help search engines to categorize your site, and allow people to find speedily your page. However, most search engines have limits as to how many Meta Keywords are viewed. It is suggested to review your keywords and ensure that they are concise and specific. Implementing these tags aptly is crucial to generate high rankings. The most significant aspect of meta-tags is that search engines pay a lot of importance to them and hence they have come to be widely accepted in the SEO process.

Meta tag optimization must be included as only a part of the overall SEO strategy. It is critical to first pay close attention to your website architecture and content strategy. If the search engine spiders cannot find your pages and your Meta tags do not support the content on the page, each Meta tag will be meaningless. “Most SEO Experts rank the page title as the most important element to optimize in order to build authority for the primary keyword on the page.”

Example Meta Tags :

Below you will find an example set of meta tags. This is for a page you want fully indexed in all search engines.


<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<HTML><HEAD>
<TITLE>SEO Tutorial – Meta Tags Optimization</TITLE>
<meta name=”description” content=”Create the perfect meta tags for high search engine placement.”>
<meta name=”keywords” content=”Meta Tags Optimization”>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1?>
<link rel=”stylesheet” type=”text/css” href=”../seo-gold.css” media=”all”>
</HEAD>
<body>

The DOCTYPE-

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>

Is the DOCTYPE, it’s not a meta tag and it’s not essential you add this to a page for good search engine placement, but if you want a page to validate in a HTML validator (i.e. http://validator.w3.org/) you’ll need to add the right one.

The TITLE-

<TITLE>SEO Tutorial – Meta Tags Optimization</TITLE>

Again this isn’t a meta tag, but it’s sometimes referred to as a meta tag by those who don’t fully understand meta tags. The title element is very, very important to a pages optimisation, which is why we have an entire page dedicated to Title Optimization. The title should include the most important phrase for that page and possibly one or two highly relevant keywords to create related phrases. The one above helps several important phrases including Meta Tags Optimization, Meta Tags, Meta Tags Tutorial, SEO Tutorial, SEO Meta Tags etc…. Don’t go over the top with adding lots of keywords, keep it short and sweet so each word gets a reasonable boost and don’t forget potential visitors (they have to read it).

The DESCRIPTION META TAG-

<meta name=”description” content=”Create the perfect meta tags for high search engine placement.”>

As covered earlier in Google the contents of the description meta tag will not have an impact on the pages search engine rankings, but may be used as the description in the search results. So be descriptive, think about what a potential visitor might click on not keyword stuffing.

The KEYWORDS META TAG-

<meta name=”keywords” content=”Meta Tags Optimization”>

Of no value to Google and probably little value to other major search engines. Easiest way to fill this meta tag is by pasting the same contents as the TITLE minus anything you added for visitors to read. In the example above we removed “SEO Tutorial – ” because that is there for visitors who read the TITLE element as part of a search engine listing.

The Character Set and links external files-

<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1?>
<link rel=”stylesheet” type=”text/css” href=”../seo-gold.css” media=”all”>

Not meta tags and will have no impact on a pages search engine placement, the Character set is used by browsers so the right set of characters are used to display your page. Don’t add one and the browser will use its default (it will guess), this might mean your page doesn’t look right to a visitor. External style sheets (CSS files) and external javascript (JS files) are referenced here. Again no impact on SEO, but if you can push some javascript or markup off your page you should. It saves bandwidth and means your pages load faster.

Meta tag optimization MUST be included as part of any good search engine optimization services but if your SEO efforts end here don’t expect to get great rankings.




-- 
Regards,

Preeti Bagad [BE(CS)] 
SW Engineer Cum Blogger

On Line Assistence :
Y! Messenger : PreetiB.A1Soft@yahoo.com

We are Looking for Paid Guest Post 

On More then 700 Blogs



DA 90+
PR 1+
Index 1000+

Post live within 12-18 hours

Your Price must be good, 

want to work continue on a long term

add or PM @  



Thanks & Regards,
Vidhya Ethiraj [BE (ECE) &MBA (HR)]
Manager HR
On Line Assistance:
Mail me on: pay2flycrew@gmail.com

Sunday, 24 November 2013

Dot Com Company



:

A company whose operations are entirely or primarily internet-based, or more specifically a company whose business model would not be possible if the internet did not exist. Dotcoms often deliver all their services over an internet interface, but products might be delivered through traditional channels as well. Dotcoms are often divided into two categories: those that provide products and services for consumers (B2C) and those that provide products and services to other businesses (B2B). In the late 1990s, Many Internet Business Companies started commonly known as dot-com companies. But out of many of them only few survived today and rest of the companies are closed or bankrupt nowadays.

What is Dot-Com Company?

Well, in simple words a Dot-com company is one whose main Business is on the Internet. They make its money/profits by doing an Online Business only. The Examples of Dot-com companies are Google, Yahoo, Amazon, eBay, Facebook, Orkut, Twitter and so on. The main purpose of these dot-com companies was to raise the capital from the venture capitalists, develop a successful web business, growing it exponentially high and later on exit from it by taking that dot-com company to the public.

A business, especially a publicly-traded company, that conducts most or all of its business over the Internet. Dot-coms may conduct business in one or more of the following areas: Content, Commerce, and Connection. Content companies provide information, either for free or for a charge, and earn most of their operating income from advertising. Commerce companies sell new and/or used goods directly over the Internet. Connection companies provide Internet services directly to customers.

How Internet Business Companies Make Money?

Well, Dot-com companies make money from 3 Cs, meaning:

- Commerce

- Content

- Connection

Commerce means selling products over the Internet such as Amazon.com, while Content means making money from the content starting from News Websites to Blogs. Content web business makes money from advertisement selling. Connection means doing a business by supplying connections such as AOL, one of the largest ISP (Internet Service Provider) in USA.

But unfortunately most of the dot-com companies failed even after literally millions of dollars of money infusion in them. Here is a List of some well-known failed Dot-com Companies.

List of well known Failed Dot-com Companies

- 360HipHop
- AmCy.com
- Boo.com
- Broadband Sports
- Cyberial Outpost
- CyberRebate
- DigiScents – tried to transmit smells over the Internet
- E-Loft.com – A pan European portal for university students
- Excite@Home
- Flooz.com
- Kozmo.com
- theGlobe.com
- Kibu.com – Online community for teen girls
- Pseudo.com – One of the first live streaming video websites
- Yadayada.com
- Zap.com

Therefore, all of the dot-com companies are just the few examples from whole list who have lost literally hundreds of millions of Venture Capitalists. Only those Internet Businesses survived in the Dot-com Bubble who have really added value to the life of the people around the world at mass scale such as Google & Amazon. Rest of the companies did not survive and some have failed even before the launch.

What is considered a Successful Internet Business?

Are you an Internet Business Owner? Then How will you tell whether it’s a successful Internet Business or not? Well, there are several criteria for this. And Financial criteria is one of them. Here are the few common criterias for successful internet business that every one of you knows.

- Web traffic
- Revenue of the Business
- Customer Base
- Google Page Rank
- Alexa Page Rank
- Back links
- Popularity

And many other such types of criterias are there. Now, according to me a true successful internet business is one which really adds value in the life of people at mass level.

Google, Amazon, Wikipedia sites & eBay are few examples of the Successful Internet Businesses. This is not because they are making millions and billions of dollars every year. But this is because they have added value in the life of literally millions of people. Can you imagine the internet without Google?

The Internet is full of online businesses of every kind. The competition for dot-com ventures is extremely high. Users can click from you to your competitor in seconds. Even getting noticed among the masses of other businesses online is a difficult task. Despite these challenges, it is possible to start a viable dot-com company. The barriers for entry are low and you have a great deal of control over your start-up costs. Focus on your business idea to develop a unique selling point that will allow you to stand out from the competition.

How to Start a Dot Com Company?

1    Research your business idea carefully. Develop a concise business plan based upon your research. Use this plan to guide you through your start-up process, adapting it as your business evolves. Carefully consider costs of your products or services and determine if your idea is viable as a revenue-producing enterprise.
    
2    Hire an accountant to assist you with the financial considerations of your business. File any necessary forms with your local, state and federal authorities. Set up a bookkeeping system and work with your accountant on a regular basis.

3    Hire a lawyer to guide you through the establishment of your business. Choose one with an expertise in Internet law, which is evolving regularly. Have your lawyer advise you on issues such as contracts, agreements and online privacy considerations.

4    Purchase a reliable computer. Use it to operate all aspects of your business. Ensure that you have a trustworthy back-up system for your files.

5    Acquire a high speed Internet connection. The rate of communication is ever increasing. Customer expectations are that you have the ability to respond quickly.

6    Hire a web developer to assist you in setting up an interactive e-commerce site. The website is your entire business when you're a dot-com company. It is your image and brand. Ensure that your site operates quickly and has a clear, user-friendly navigation system. Integrate the most current security into your website. Create an interactive community through a blog and forum. Feedback has come to be expected by online consumers. Communication with your customers is increasingly important to your success.

Dot-coms were hugely popular investments in the 1990s, with IPOs of hundreds of dollars per share, even if a company had never produced a profit and, in some cases, had never earned any revenue. This came from the theory that Internet companies needed to expand their customer bases as much as possible and thus corner the largest possible market share, even if this meant massive losses. While this worked for some dot-coms, notably Google, which did not produce a profit for its first several years of operation, the theory was unsustainable because, in a given industry, only one or two companies could corner large market shares, meaning most dot-coms were doomed to failure. This dot-com bubble burst in 2000.

Top Dot Com Companies of the World.


-Amazon.com

Amazon.com, Inc. is an American electronic commerce company based in Seattle, Washington. It was one of the first major companies to sell goods over the Internet and was one of the iconic stocks of the late 1990s dot-com bubble. After the bubble burst Amazon faced skepticism about its business model, but it made its first annual profit in 2003. Amazon also owns Alexa Internet, A9.com, and the Internet Movie Database (IMDb).Founded as Cadabra.com by Jeff Bezos in 1994 and launched in 1995, Amazon.com began as an online bookstore, though it soon diversified its product lines, adding DVDs, music CDs, computer software, video games, electronics, apparel, furniture, food, and more.



-eBay.com

eBay Inc. manages an online auction and shopping website, where people buy and sell goods and services worldwide. The online auction site was founded in San Jose, California on September 3, 1995 by computer programmer Pierre Omidyar as AuctionWeb,Millions of collectibles, appliances, computers, furniture, equipment, vehicles, and other miscellaneous items are listed, bought, and sold daily.


-Google.com

Google, Inc. is an American public corporation and search engine, first incorporated as a privately held company on 7 September 1998. The company had 9,378 full-time employees as of September 30, 2006 and is based in Mountain View, California. Eric Schmidt, former chief executive officer of Novell, is Google's CEO, after co-founder Larry Page stepped down. The name "Google" originated from a misspelling of "googol," which refers to 10100 (the number represented by a 1 followed by one-hundred zeros).



-Priceline.com

Priceline.com is a website devoted to helping users obtain discount rates for travel-related items such as airline tickets and hotel stays. It is headquartered in Norwalk, Connecticut, United States. Priceline is the brainchild of digital entrepreneur Jay Walker; thus its parent company is Walker Digital.



-MSN.com

MSN (or The Microsoft Network) is a collection of Internet services provided by Microsoft. Initially released on August 24, 1995, to coincide with the release of Windows 95, the range of services has since changed greatly. The Hotmail webmail service was amongst the first, followed by the instant messenger service MSN Messenger, which has recently been replaced by Windows Live Messenger. According to Alexa.com, MSN.com is currently ranked 2nd amongst all websites for Traffic Rank.



-Yahoo.com

Yahoo! Inc. is an American internet services company. It operates an Internet portal and provides a full range of products and services including a search engine, the Yahoo! Directory and Yahoo! Mail. It was founded by Stanford graduate students Jerry Yang and David Filo in January of 1994 and incorporated on March 2, 1995. The company is headquartered in Sunnyvale, California.
According to Web trends companies Alexa Internet and Netcraft, Yahoo! is the most visited website on the Internet today with more than 412 million unique users. The global network of Yahoo! websites received 3.4 billion page views per day on average as of October 2005.

-IMDB.com

The Internet Movie Database (IMDb) is an online database of information about actors, films, television shows, television stars, video games and production crew personnel. Owned by Amazon.com since 1998, the IMDb celebrated its fifteenth anniversary on October 17, 2005. As of August 22, 2006 IMDb featured 825,865 titles and 2,179,165 people.

-Network Solutions

Network Solutions, LLC is a technology company which was founded in 1979. The domain name registration business has become the most important division of the company; as of 2006, Network Solutions manages more than 7.6 million domain names. Their size, founding status, and longevity have made them one of the most important corporations affecting domain name price and policy.

-Paypal.com

PayPal is an e-commerce business allowing payments and money transfers to be made through the internet. It serves as an electronic alternative to traditional paper methods such as checks and money orders. PayPal performs payment processing for online vendors, auction sites, and other corporate users, for which it charges a fee. In October 2002, PayPal became a wholly owned subsidiary of eBay. Their corporate headquarters is in San Jose, California, at eBay's North First Street satellite office campus. The company also has significant operations in Omaha, Nebraska; Dublin, Ireland; and Berlin, Germany. PayPal account holders must be 18 or over with a debit/credit card or bank account and an e-mail address.

-SKYPE

Skype is a proprietary peer-to-peer Voice over IP (VoIP) network founded by the entrepreneurs Niklas Zennström and Janus Friis, also founders of the file sharing application Kazaa. It competes against existing open VoIP protocols such as SIP, IAX, and H.323. The Skype Group, acquired by eBay in October 2005, is headquartered in Luxembourg, with offices in London and Tallinn.

-MySpace.com

MySpace is a social networking website offering an interactive, user-submitted network of friends, personal profiles, blogs, groups, photos, music, and videos. MySpace also features an internal search engine and an internal e-mail system. It is headquartered in Santa Monica, California, USA, while its parent company is headquartered in New York City, and it also has a back up server there. According to Alexa Internet, it is currently the world's fourth most popular English-language website, the sixth most popular website in any language and the third most popular website in the United States.

-Youtube.com

YouTube is a popular free video sharing Web site which lets users upload, view, and share video clips. Founded in February 2005 by three employees of PayPal, the San Bruno-based service utilizes Adobe Flash technology to display video. The wide variety of site content includes movie and TV clips and music videos, as well as amateur content such as videoblogging. Currently staffed by 67 employees, the company was named TIME magazine's "Invention of the Year" for 2006. In October 2006, Google, Inc., announced that it had reached a deal to acquire the company for $1.65 billion USD in Google's stock. The deal closed on 13 November 2006.

-Blogger.com 

Blogger is a weblog publishing system owned by Google since 2003. Blogger enables blogs to be hosted on its own servers (http://www.blogger.com/ with the blog created as a subdomain of blogspot.com, i.e. foo.blogspot.com) or on the server of the blogger's choosing, transferred via FTP or SFTP. Blogger was launched by Pyra Labs in August 1999. As one of the earliest dedicated blog-publishing tools, it is credited for helping popularize the format.
In February 2003, Pyra Labs was acquired by Google.

-Rediff.com

Rediff.com India, NASDAQ: REDF is a popular news, information, entertainment, and shopping portal. It was founded in 1996 and is headquartered in Mumbai, India with offices in New Delhi and New York, USA. As per Alexa rating , Rediff is the No. 1 Indian web portal. It is the only India-based website to appear in first 100 websites. It has more than 250 employees. Rediff.com also offers the Indian American community one of the oldest and largest Indian weekly newspaper, India Abroad, which it acquired in 2001.


Best Internet Companies, Best Internet Suppliers, Best Online Companies, List of Internet Companies.


-- 
Regards,

Preeti Bagad [BE(CS)] 
SW Engineer Cum Blogger

On Line Assistence :
Y! Messenger : PreetiB.A1Soft@yahoo.com







Who is Crazy Gurus Who is Sober Professors

Who is 
Crazy Gurus  
Who is 
Sober Professors



Thursday, 21 November 2013

Classes in Java


Classes in Java :

Java class is nothing but a template for object you are going to create or it’s a blue print by using this we create an object. In simple word we can say it’s a specification or a pattern which we define and every object we define will follow that pattern. In the object oriented approach, a class defines a set of properties (variables) and methods. Through methods certain functionality is achieved. Methods act upon the variables and generate different outputs corresponding  to the change in variables. A Java class is a group of Java methods and variables. Each Java source code file can contain one public class. The name of this public class must match the name of the Java source code file. If the public class is called “ballistics,” then the filename would be “ballistics.java.”



What does Java Class Consist?

When we create class in java the first step is keyword class and then name of the class or identifier we can say. Next is class body which starts with curly braces {} and between this all things related with that class means their property and method will come here.

Template is:

Class (name of the class) {

(Here define member of class)

}

Access level of class - Java class has mainly two type of access level:

Default - class objects are accessible only inside the package.

Public - class objects are accessible in code in any package.

Syntax of a Java Program :

package package_name;

//import necessary packages

import package_name.*;

Access Modifier class class_name{

member variables;
member methods;

public static void main(String[] args) {
    ...
    ....

    }

}


Objects in Java:

If we consider the real-world we can find many objects around us, Cars, Dogs, Humans, etc. All these objects have a state and behavior. If we consider a dog, then its state is - name, breed, color, and the behavior is - barking, wagging, running. If you compare the software object with a real world object, they have very similar characteristics. Software objects also have a state and behavior. A software object's state is stored in fields and behavior is shown via methods.
So in software development, methods operate on the internal state of an object and the object-to-object communication is done via methods.

A class can contain any of the following variable types.

  - Local variables: Variables defined inside methods, constructors or blocks are called local variables. The variable will be declared and initialized within the method and the variable will be destroyed when the method has completed.

  - Instance variables: Instance variables are variables within a class but outside any method. These variables are instantiated when the class is loaded. Instance variables can be accessed from inside any method, constructor or blocks of that particular class.

  - Class variables: Class variables are variables declared with in a class, outside any method, with the static keyword.
A class can have any number of methods to access the value of various kinds of methods.

What are members of Class?

When we create a class its totally incomplete without defining any member of this class same like we can understand one family is incomplete if they have no members.

  - Field: field is nothing but the property of the class or object which we are going to create .for example if we are creating a class called computer then they have property like model, mem_size, hd_size, os_type etc

  - Method: method is nothing but the operation that an object can perform it define the behavior of object how an object can interact with outside world .startMethod (), shutdownMethod ().

  - Access Level of members: Access level is nothing but where we can use that members of the class.
Each field and method has an access level:

    private: accessible only in this class
    package or default: accessible only in this package
    protected: accessible only in this package and in all subclasses of this class
    public: accessible everywhere this class is available

Real world example of Class in Java Programming :

In real world if we want to understand about the class everything of same quality  can be visualize as a class e.g. men,women,birds ,bicycles ,cars or  we can say vehicle .
The entire vehicle will make one class they have the property like no_of_wheels, color, model, brand etc.now we can think changeGear () and speedOfvehicle (), applyBreak () etc as a method on that class. Similarly all human being also can be one class now their member will be a men ,women ,child.,isAlive() ,isDeath() can be their method or behavior of that class .again we can make Men or women a separate class and define their property and method accordingly,
In short in java every problem we get solution can be think in terms of class and object.

One Java class example:

Class Stock {

Public commodity;
Public price;
Public void buy (int no_of commodity) {}
Public boolean sale () {}

}

In this example Stock is called Class and commodity, price are field and buy() and sale() are two methods defined inside class. To access elements of Class you need to create an instance of class Stock. You can create instance of Class using keyword new as shown below

Stock highBetaStock = new Stock();

For calling method of Stock just call by using instance.

highBetaStock.buy(1000);
highBetaStock.sell();

Summary:

In short in java everything must be thinking in terms of java class its nothing but a template they have their own members and methods for accessing those members. The entire member has their own visibility which is decided by the developer where they want to use those objects.

Preeti Bagad [BE(CS)] 
SW Engineer Cum Blogger

On Line Assistence :
Y! Messenger : PreetiB.A1Soft@yahoo.com







Best Ground Staff Fly-Crew

Best Cabin Crew Fly-Crew

Best AME Fly-Crew

Best Pilots Fly-Crew





UpLoad Your CV only for Rs 100 or USD $ 10 for 1 Year

We will send you Job Alerts and your CV to all HRs
Mail to, 
Vidhya@aerosoft.co.in
We believe that for
Pessimistic its Aviation Recession
and for
Optimistic it is an Opportunity.