Posted on 21-April-08 by Nas
Today’s coding, we will play with array.. Yeay!
Here is the coding :
class BitLogic
{
public static void main(String[] args)
{
String binary[] = {”0000″,”0001″,”0010″,”0011″,”0100″,”0101″,”0110″,”0111″,”1000″,”1001″,”1010″,”1011″,”1100″};
int a = 3;
int b = 6;
int c = a|b;
int d = a&b;
int e = a^b;
int f = (~a&b)|(a&~b);
int g = ~a&0×0f;
System.out.println(”a = ” + binary[a]);
System.out.println(”b = ” + binary[b]);
System.out.println(”c = ” + binary[c]);
System.out.println(”d = ” + binary[d]);
System.out.println(”e = ” + binary[e]);
System.out.println(”f = ” + binary[f]);
System.out.println(”g = ” + binary[g]);
}
}
Enjoy..!!
Filed under: Educational, Fun, Java, Sun Microsystem, Technology | No Comments »
Posted on 20-April-08 by Nas
Do the coding provided and find out the output for it.
Lets begin :
import java.util.regex.*;
class RegularExp
{
public static void main(String[] args)
{
Pattern p = Pattern.compile(”[a-g]“);
Matcher m = p.matcher(”Andrew is great”);
boolean b = false;
while(b = m.find())
{
System.out.print(m.start() + ” “);
}
}
}
Post the output in my comment section.. TQ
Filed under: Educational, Fun, Java, Sun Microsystem, Technology | No Comments »
Posted on 29-March-08 by Nas
I have bumped on to a website which provide previous SCJP questions for reference. I want to share it here so people can know how tricky it was. Have fun!
public class SCJPTest
{
private static int j = 0;
private static boolean methodB(int k)
{
j = k;
return true;
}
public static void methodA(int i)
{
boolean b;
b = i < 10 | methodB(4);
b = i < 10 || methodB(8);
}
public static void main(String[] args)
{
methodA(0);
System.out.println(j);
}
}
Compile and run this program to get the answer for it. Below are some choices of answer :
What is the result?
A. The program prints “0″
B. The program prints “4″
C. The program prints “8″
D. The program prints “12″
E. The code does not complete.
Filed under: Educational, Fun, Infotainment, Java, Open Source, Sun Microsystem, Technology | No Comments »
Posted on 28-March-08 by Nas
Assertions syntax :-
assert <boolean_expression>;
assert <boolean_expression>:<assertionError_expression>; (use this for switch)
There are 3 types of assertions that can be used :-
switch(assertions)
case 1:
break;
case 2:
break;
case 3:
break;
default: assert (i > 0) : “AssertError Message”;
Filed under: Educational, Fun, Infotainment, Java, Open Source, Sun Microsystem, Technology | No Comments »
Posted on 1-March-08 by Nas
As posted previously, I’ve mentioned that Java is a programming language based on object which also known as Object-oriented Programming. What is Object-oriented Programming?
OOP
* An object-oriented programming is a programming rule that uses objects and their interaction to design applications & computer programs
* An object-oriented is a problem solving technique to develop software systems. It is a technique to think real world in-term of objects. (oriented means based)
Development environment :
Java technology provides a number of tools such as compiler, interpreter and a documentation generator.
Application environment :
Java technology applications are standalone programs that do not require a web browser to execute. Applications are the programs which can be run on any machine where the JRE is installed.
Deployment environment :
There are 2 types of deployment technology available in J2SE for deploying client-side java applications on the desktop.
# Java plug-in : It’s a tool used for deploying applet that run inside a web browser
# Java web-start : It’s a tool used for deploying standalone Java application on a desktop using a protocol known as Java Network Launching Protocol (JNLP)
Filed under: Educational, Fun, Java, Sun Microsystem, Technology | Tagged: basic java, java technology, object-oriented programming, oop, Technology | No Comments »
Posted on 28-February-08 by Nas
We use interface in Java because it doesn’t support multiple inheritance. Interface doesn’t not contain body, only methods and arguments. For example :
interface ABC {
void option1(int One);
void option2(int Two);
void option3(int Three);
void option4(int Four);
}
class Qwerty implements ABC {
// remainder of this class implemented as before
}
Theoretically, but I haven’t try it tho.
Filed under: Educational, Fun, Java, Open Source, Sun Microsystem, Technology | Tagged: implements, interface, intermediate, java technology, theory | No Comments »
Posted on 26-February-08 by Nas
In Java programming, you can simply count the letters you have used in a sentence (including spaces). Sun Microsystems should add one more feature for Java technology, FUN! Here is the coding on how to make the simple program
class LetterCount { // class name
public static void main(String[] args) { // main method (no return type)
String sentence = “Welcome to my Java knowledge sharing blog!”; // declaring String
System.out.println(sentence); // the 1st output from the system
System.out.println(”Letters used in the sentence is ” + sentence.length()); // letters counter
}
}
You can try this code to see the output of this simple program. Good luck and enjoy trying out the code.
Filed under: Educational, Fun, Java, Open Source, Technology | 3 Comments »
Posted on 26-February-08 by Nas
I will keep my lesson here as my reference in the future so that if I lost all the hard copies, I can find the soft copies here. If you find out it is interesting for you to read, then you can continue reading this blog. Make yourself comfortable and I am pleased to share the knowledge here with all of my blog readers. By doing this, I think we can share and spread our knowledge here in wordpress.
It goes…
The Java technology is :
-
A programming language
-
A development environment
-
An application environment
-
A deployment environment
-
Similar syntax with C++
-
Used to develop applets & applications
* Program is a set of instructions
* A programming language is a notation or syntax to write a program
* A programming language is an artificial language that can be used to control the behavior of a computer machine
* Many programming languages have some form of written specifications of their syntax and semantics (meaning)
If we write Class_identifier class { , the JVM will give ‘class’ or ‘interface’ expected error. Sample for form of written specifications of their syntax. In Java, the syntax to write a Class_identifier after using the class syntax
Filed under: Educational, Java, Open Source, Sun Microsystem, Technology | No Comments »
Posted on 25-February-08 by Nas
After completing the ePractice test, today our instructors once again dividing us into classes. I’ve been separated with my good friends in previous class. I’m in an advance class where all the good students are present. It will be hard for me to cope in this class but I will try my best to become the best among the best. I have a terrible headache since evening and I don’t want to mention about my class a lot because it will give me more headache.
While browsing in Java website just now, I’ve bumped onto an article about Java champion. I don’t know what it is all about but it seemed like a group where a bunch of pro Java programmers gathered and find a candidate to become a Java champion. That is what I thought of about the Java champion thingy. One more thing, I’m currently using one of my friends laptop to post this. This laptop using Microsoft Windows Vista and it is totally sucks because with 1GB of RAM, this laptop doesn’t run smooth as what I’m expected it to run. Apparently, I was thinking why Microsoft creates it at first? The operating system reducing the speed of this machine and I have tried to change the operating system but it seems like they have locked the BIOS setting so that this machine can’t be installed with other operating systems.
From 1,000MB of RAM, this operating system had used almost 700MB of it for a particular process. I don’t know how to make this machine runs faster. Unlike Windows XP and OpenSUSE, it’s way too slow and this machine already runs with a good specifications. I’m thinking of tweaking the performance of this laptop tho and still finding for the right way to do it and so far I can’t see any method of making that happen.
Filed under: Educational, Microsoft, Online News, Open Source, Technology, Thought | No Comments »
Posted on 25-February-08 by Nas
I’ve been told by my instructor that I managed to pass for ePractice test and will continue to the next step becoming a Java certified programmer. Will continue with SL-275 book after this and completing that book in 1 month time. Expected to graduate this course in another 3 months. After that I will be a Java programmer! I hope SL-275 is not as hard as I thought. I am so happy because 11 modules had been completed and 16 modules to go in SL-275. Gosh! 3 months more of headache and digging some knowledge. I am still thinking what am I going to do after having Java certificate. Maybe I’m going to take Oracle’s courses. I want to exactly know how does those technology works. Wish me luck! 
Filed under: Educational, Java, News, Rant, Sun Microsystem, Technology, Thought | No Comments »