Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword or section
Like this
0 of .
Results for:
No results containing your search query
P. 1


Ratings: (0)|Views: 22|Likes:
Published by kktamang09

More info:

Published by: kktamang09 on Apr 13, 2010
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





Re: MCS-024 - Object Oriented Technologies And Java Programming - MCA(2)/024/Assign/09 Posted On:2/16/2010 1:22:07 PMQuestion 2 : a) Explain why Java is platform independent. Also explain advantage of platform independence.a)When Java Code is compiled a byte code is generated which is independent of the system. This byte code is fedto the JVM (Java Virtual Machine) which is resided in the system. Since every system has its own JVM, it doesn'tmatter where you compile the source code. The byte code generated by the compiler can be interpreted by anyJVM of any machine. Hence it is called Platform independent Language.Java's bytecodes are desgined to be read and interpreted in exactly same manner on any computer hardware or operating system that supports Java Runtime Environment.Advantages:One of the key reasons Java technology is useful in a networked environment is that Java makes it possible tocreate binary executables that will run unchanged on multiple platforms. This is important in a networkedenvironment because networks usually interconnect many different kinds of computers and devices. In a typicalenterprise environment, for example, a network might connect Macintoshes in the art department, UNIXworkstations in engineering, and PCs running Windows everywhere else. Although this arrangement enablesvarious kinds of computers and devices within the company to share data, it requires a great deal of administration. Such a network presents a system administrator with the task of keeping different platform-specificeditions of programs up to date on many different kinds of computers. Programs that can run without change onany networked computer, regardless of the computer's type, make the systemadministrator's job simpler, especially if those programs can actually be deliveredacross the network.In addition, the emerging proliferation of network-enabled embedded devices represents another environment inwhich Java's platform independence is useful. In the workplace, for example, various kinds of embedded devices,such as printers, scanners, and fax machines, are typically connected to the internal network.Network-connected embedded devices have also appeared in consumer domains, such as the home and car. Inthe embedded world, Java's platform independence can also help simplify system administration. Jini technology,which aims to bring plug and play to the network, simplifies the task of administering a dynamic environment of network-connected embedded devices for both consumers at home and systems administrators at work. Once adevice is plugged into the network, it can access other devices attached to the network, and other devices canaccess it.
To achieve this ease of connectivity, Jini-enabled devices exchange objects across the network, a technique thatwould be impossible without Java's support for platform independence. From the developer's perspective, Javacan reduce the cost and time required to develop and deploy applications on multiple platforms. Even thoughhistorically, many (or most) applications have been supported on only one platform, often the reason was that thecost involved in supporting multiple platforms wasn't worth the added return. Java can help make multi-platformsupport affordable for more types of programs.On the other hand, Java's platform independence can act as a disadvantage as well as an advantage for softwaredevelopers. If you are developing and selling a software product, Java's support for platform independence canhelp you to compete in more markets. Instead of developing a product that runs only on Windows, for example,you can write one that runs on Windows, OS/2, Solaris, and Linux. With Java, you can have more potentialcustomers. The trouble is, so can everyone else. Imagine, for example, that you have focused your efforts onwriting great software for Solaris. Java makes it easier for others to write software that competes in your chosenmarket niche. With Java, therefore, you may not only end up with more potential customers, but also with morepotential competitors. But perhaps most significantly for developers, the fact that Java code can run unchangedon multiple platforms gives the network a homogeneous execution environment that enables new kinds of distributed systems built around networkmobile objects. APIs such as object serialization, RMI (Remote MethodInvocation), and Jini take advantage of this underlying capability to bring objectoriented programming out of thevirtual machine and onto the network. (Moreinformation on Jini is given in Chapter 4, Network Mobility.)b) What are different relational operators in Java? Write a Java program to explain the use of relational operators.The Equality and Relational OperatorsThe equality and relational operators determine if one operand is greater than, lessthan, equal to, or not equal to another operand. The majority of these operators willprobably look familiar to you as well. Keep in mind that you must use "==", not "=", when testing if two primitivevalues are equal.== equal to!= not equal to> greater than>= greater than or equal to< less than<= less than or equal toProgramme :
public class marks{static int stud1;public marks(int a){stud1=a;}public void grade(){if((stud1>70)&&(stud1<100))System.out.println(“Grade A”);elseif((stud1>50)&&(stud1<70))System.out.println(“Grade B”);elseSystem.out.println(“Fail”);}public static void main(String args[]){marks m1=new marks(80);m1.grade();}}The symbols && a n d || are the logical AND a n d OR operators used to evaluate logicalexpressions. Use && and || in the evaluation of compound expressions of the form• expression_1 && expression_2where expression_1 and expression_2 each evaluate to a scalar, logical result.The && and || operators support short-circuiting. This means that the second operand is valuated only when theresult is not fully determined by the first operand

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->