Pros And Cons Of Dynamic Java Compilation

April 19th, 2011 by No comments »

java code helpThere often exists the need for dynamic code generation; various project that Java developers undertake need to utilize dynamic codes followed by their compilation. To come up with the best results it is important to write the Suite class, get it compiled and finally run it. If it works well then surely one can say that the project was a success. Everything is fine as long as all this work is done manually, however compiling each step manually can be tedious and tiring, therefore we need to find a way to automate this entire process. Automation of these steps often results in problems and therefore we need to utilize the right software’s for optimum results.

Automating The Compilation Process With The Help Of Dynamic Java

Java software developers are aware of the need to automate the compilation process as it doesn’t just help in getting rid of a boring job, but it also saves a lot of our precious time which we can utilize for more creative purposes. Hence, it is important to use Java to help automate the compilation process i.e. Dynamic Java Compilation. Java version 1.6 has a whole class named javax.tools. JavaCompiler that is specialised in offering us automatic compilation. Using this class is pretty easy, and all you need to do is follow these four simple steps:

  1. » Read more: Pros And Cons Of Dynamic Java Compilation
Bookmark and Share

Curiously Protective C++ Code – A Strange Language Specific Error

March 19th, 2011 by No comments »

java code protectionWorking with a bit of code last week I stumbled into something unusual. I was working on something quite basic so kind of surprised when I came across a compilation error. GCC was telling me that I couldn’t access a protected member. Thinking I understood the concept of inheritance I was quite confused as to why I got this error message. Can you spot the problem in the code below?
class base{protected: int a;};class derived: protected base{ int sum;public: void add( base const &amp;amp; o ) <br>{ sum += o.a; //error here, why? }};My difficulty perhaps had a lot to do with working in various languages; this is my first major C++ project in a few years. While the concepts of OOP migrate between the languages well, there are some tricky bits. The code above is a very good example of how the fine points of languages tend to differ. For example, if you converted the above into the most equivalent Java code you’d find that you don’t get an error, it works exactly as you intended.

Just to review, how should protected inheritance work? In this case the protected inheritance doesn’t actually matter, it could be replaced with public inheritance (as it would in the Java equivalent). The variable a is protected in the base class. That means that derived classes are allowed to access it. That is essentially what protected means, as opposed to private in which the derived class could not access it. So why then can’t the add function access a?

» Read more: Curiously Protective C++ Code – A Strange Language Specific Error

Bookmark and Share

Java Programming, A Hello World Program

February 19th, 2011 by No comments »

 java sample codeJava is the new trend amongst the world of programming languages, The most famous languages were C and C++. The C/C++ languages depended mainly on pointers and memory allocation techniques to actually utilize memory space to store data.

In Java there are no referencing, Pointing and memory allocation required, instead we use objects.Objects are children of the class or function you declare,

This makes Java easier to use, and it is a lesser stress for the processor.

For your ease, IDEs are very helpful in running huge lines of codes,

so if you are interested in Java then the recommended IDEs are

Eclipse and Netbeans.

» Read more: Java Programming, A Hello World Program

Bookmark and Share
Søkemotoroptimalisering - Toshiba A55-s3261 Battery - Outlook Suche - Property In Bulgaria - Below Market Value Property Deals