Wednesday, February 26, 2020

Comparison between C++ and Java Research Paper Example | Topics and Well Written Essays - 1000 words

Comparison between C++ and Java - Research Paper Example Later it was adapted as the basis for â€Å"HotJava† thin client that depends on a virtual machine that is very portable and secure. Java is provided with a wide-ranging library that supports total abstraction for the fundamental platform. Java is a statically typed OOP like C++ and both languages display a similar syntax though their syntaxes are not compatible with each other. Moreover, Java was designed from scratch and was aimed at portability. (Deitel & Deitel, 2009) Comparison of Features Java and C++ differ significantly when it comes to certain features and implementation in each language. These are discussed below with examples to clarify the differences. Java does not possess multiple inheritances, instead it relies on interfaces. Interfaces in Java are comparable and largely similar to classes in C++ that have nothing except for virtual functions. Java allows inheritance from one base class only even if the other base classes are composed of little else than abstrac t methods (which are pure virtual functions). However Java allows the implementation of multiple interfaces which is similar to C++ and is nearly similar. (Horstmann & Cornell, 2008) An interface in Java for a Stack would be: public interface Stack { public void Push(Object o); public Object Pop(); }; The structure for C++ is similar and is shown below: class Stack { public: virtual void Push(Object&) = 0; virtual Object& Pop() = 0; }; It must be borne in mind that an interface in Java is not a class and any functions declared in a Java interface are not implementable in the same interface. A Java interface is not allowed any member variables either. This helps Java to eliminate the multiple virtual inheritance problems seen in C++ as it is not possible to inherit identical member variables from more paths than one. Virtual inheritance creates difficulties for the programmers of all kinds. Java solves this by eliminating multiple inheritances of classes by permitting multiple interf ace implementations. This has simplified Java appreciably in comparison to C++. However there is a drawback too. Java does not allow inheriting implementation from multiple classes in cases where there are no identical member variables too. Most coding situations require that variables have multiple inheritances from base classes that possess data and functions. While C++ can help implement these through careful variable naming, Java disallows it altogether. Another aspect of major difference is garbage collection. Garbage collection is a way to manage memory by freeing memory blocks that are not being referred to anymore. For example if the Java code presented below is considered: Clock a = new Clock(); // a is a new clock // ... a is used for a while a = null; // a is set to null and the system will remove it afterwards The code above creates a new Clock object by using the keyword new. The variable a is used to refer to this new object. a has a similar structure to reference vari ables used in C++ but Java allows the reassignment of references unlike C++. The variable a is used for some time after which it is reset to null. The Java runtime system keeps a in watch and when it detects that there are no more references to a, it brands a as garbage and clears it up. This aids in returning memory to the heap. In comparison C++ does not offer such an extensive garbage collection system. Although third party freeware and

Sunday, February 9, 2020

Exam questions Article Example | Topics and Well Written Essays - 250 words

Exam questions - Article Example Another one is that it is a threat to social freedom. Plato’s study was already revolving around enlightenment, and according to him â€Å"Enlightenment is a Myth and Enlightenment reverts to Mythology†. The criticism more or less conveys the same meaning of critiques made by Adorno. The most powerful claim and argument placed by Mr. Robin Collingwood was â€Å"art is an attempt to achieve beauty†. According to him the physical transformation and appearance is not the beauty but the art, inner self, purity of heart, sculpture is important which defines the beauty. And the one or the thing which looks beautiful is a sublime i-e looks beautiful, inspires you but then evaporate soon. I will go with the second philosopher because Edmund Burke’s view was that sublime and the beautiful are mutually exclusive. So Collingwood’s thought was much better. Beauty is when it rests in the hearts of the people watching or experiencing it and not meant to evaporate or vanish out as the ages fall. Stories Homer and Iliad’s have marked affects on public opinions and shaping ancient Greek values. The reason why Iliad has so much admiration among the ancient’s Greek is because it is an epic poem, which means it was used to speak narrative of â€Å"elevated matters†. Plato also put forward and instruction or an alternative view of poetry as well Aristotle was steeped in Homeric tradition and clearly saw another side which Plato was failed to recognize and analyze. He construed more positively the role mimesis in art opposite of Plato and sees more positivity of homer’s stories in the shaping of Greek culture and values. Robin G. Collingwood has expressed his views in the words that the stories of Homer and Iliad have failed to empathize properly, with the historical actors or comprehend their behavior accurately in their own terms. He also said that they have failed to elucidate the past and they were only used to condemn it. The views by Aristotle were best