Inputting in Java

If you want to read any input in java you might be thinking how it be done. Because most people don't know how to do it. In my experience I tried many ways.But they did not solve my whole question. Finally I found a better way to read input in Java. If you are familiar with languages like C++ or C, it is quite different from the workhorse cout and cin in C++ and printf() and scanf() in C.
Now let's start the lesson,
All the input routines I'm showing here require the line

import java.io.*;

at the beginning of the source file.

Inputting a String

public static String getString() {

String s = null;
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
try {
s = br.readLine();
} catch (Exception e) {
}
return s;
}

Before JDK 1.1.3 you cannot do this. So if you are using older version do this.

public static String getOldString() {
String s = "";
int ch;
try {
while ((ch = System.in.read()) != -1 && (char) ch != '\n') {
s += (char) ch;
}
} catch (Exception e) {
}
return s;
}

Introduction to Inheritance in c++

A class can access the properties of another class. The class is inherited is called the base class and the inheriting class is called the derived class in C++ inheritance terminology. The derived classes have all the features of the base class and the programmer can choose to add new properties specific to the newly created derived class.

Features of Inheritance
  1. Reusability.
  2. Saves time and effort.
  3. Increases the structure of program which results in greater reliability.
  4. Polymorphism
Need more help? click here


Programming with c++. Need header files?

When you write programs in c++ language you will face some heavy work with program. If that happens to you c++ header files helps you to get rid of that heavy work. Simply you have to include header file to your program. If you do that you can reduce unnecessary codes.

You can download some main header files here.

  1. medley.h
  2. winconio.h
  3. winconio1.h
Unzip the file and copy the ***.h file to the "include folder". It is something look like this,
C:\Program Files\Microsoft Visual Studio\VC98\Include

scjp Exam

If you are learning Java, aiming the scjp exam, probably you might be looking for tutorials. There are many tutorials available for scjp on the internet. But only few are relevant to the exam. Selecting tutorials takes much time. But time is a crucial point in the face of an exam. Therefore, valuable time spent on selecting becomes just wastage.

Now I'll give you a good solution! The tutorials I’m presenting you here helped me a lot in my scjp exam and I sincerely hope they will be much useful to you too to gain top marks at the exam. They provide you the ability to handle the complete theoretical Java knowledge needed at the exam.

I hope these will help you to pass the scjp exam with flying colors.
All the best!

Please follow the below links to download the tutorials…
  1. Decleration and access control
  2. Object orientation
  3. Assignments
  4. Operators
  5. Flow control exception and assertions
  6. Strings IO Formatting and Parsing
  7. Generic and Collections
  8. Inner class
  9. Threads
  10. Development
  11. Glossary

Are you interested in java programming? get netBeans

netBeanas is the most suitable Integrated Development Environment(IDE) for java programming. You can do anything related to java language from netBeans.It supported not only java language but also c/c++, and even dynamic languages such as PHP, JavaScript, Groovy, and Ruby. You must have only java version for run this IDE. It can be simply downloaded from netBeans site for totaly free. netBeans IDE runs on many operating systems including Windows, Solaris, Linux, and Mac OS.

The NetBeans IDE 6.5 provides several new features and enhancements, such as rich PHP, JavaScript and Ajax editing features. Now you can download netBeans 6.7 also.

Download netBeans