Login Register






My Java Programming Journey filter_list
Author
Message
My Java Programming Journey #1
Hi!

I am XTRMS4NITY, and I am creating this thread to tell my story of Java programming. I hope everyone will enjoy watching this novice grow to a good Java programmer.

This has been my mantra, that I have a list of things that are seem impossible for me to achieve and Java programming is included in the list. If I learn Java, I am gong to take it out of the list but I will still continue programming until I get old. This thread will serve as my diary of Java programming and I am going to update this thread if I have some story to tell. Smile

Happy hacking and programming everyone!

Now, I know how to/what are:

1. Download and Install the JDK and Setup the Path
2. Enter the Program
3. Compile and Run the Program
4. Correct Errors
5. Modify the Hello World Program (Please don't say I'm boring)
6. Data Types (int, double, String, char, and bool)
7. Name Variables (naming rules)
8. Declare Variables
9. Assign Data to Variables
10. Classes and Objects
11. Class Data Members
12. Creating Constructors
13. Methods, and Creating Class Objects
14. Accessor Methods
15. Final Variables
16. Math Class
17. Mixing Arithmetic Data Types
18. Translating a Formula to Java Code
19. Using Scanner for Input
20. Relational Operators
21. Logical Operators
22. If-Else Statement
23. Nested Statements
24. If-Else If Statement
25. While Loop
a. Count-controlled Loops
b. Condition-controlled Loops
c. Results-controlled Loops
26. For Loop
27. Break and Continue
28. Defining Methods
a. Methods with Multiple Parameters
b. Predicate Methods
c. Void Methods
d. Pass By Value
29. ArrayLists
a. Declaring and Initializing an ArrayList
b. Adding Data to an ArrayList
c. Accessing ArrayList Elements
30. Classes And Object-Oriented Programming
31. Inheritance
a. Overriding Methods
b. Protected Members
c. The Object Class
32. Polymorphism
a. Working with Abstract Classes
b. Working with Interfaces
33. Arrays
a. Declaring an Array
b. Accessing Array Elements
c. Passing Arrays as Function Arguments
d. Two-Dimensional Arrays
34. Java Control Flow Constructs
a. The Switch Statement
b. The do-while Loop
c. The For-Each Loop
35. File Processing
a. Try Catch Statement
b. Writing Data to a File
c. Reading Data from a File
d. Appending Data to a File
e. Writing Characters to a File
f. Reading Characters from a File






Update:

March 23, 2014:

Finally!!! I received my training certificate for Java Programming. I am now a certified Java Programming Beginner!

I covered my real name. Biggrin

Quote:[Image: 6e40fc4998354ce7de8cc3fc571d3ce0.jpg]

Now to continue learning, I will write programs that I am very interested in. Biggrin

I am really happy, it's a sense of accomplishment for me and I am proud of it. Although experts can say "Boo You are Boring Noob!".

Now, who's happy for me too? Biggrin

Reply

RE: My Java Programming Journey #2
Looking forward seeing some good stuff from you Smile Good luck
My Blog: http://www.procurity.wordpress.com
Donations: 1HLjiSbnWMpeQU46eUVCrYdbkrtduX7snG

Reply

RE: My Java Programming Journey #3
@Ex094: Thank you. I was looking forward to see improvements in me, too.

Reply

RE: My Java Programming Journey #4
Hello

I just want to wish you good luck Smile

If you need help in anything or have questions let us know please...

Happy Coding
[Image: wvBFmA5.png]

Reply

RE: My Java Programming Journey #5
@Ligeti: Hi! Thank you for wishing me good luck. Deque told me if I have questions I will make a thread so everyone can benefit from the answer.

Reply

RE: My Java Programming Journey #6
Looking forward to see you at

200. Reflection
201. JNA
202. JNI
203. Byte Codes Instructions
204. Byte Codes Injection( ASM, BCEL )
(This post was last modified: 03-17-2014, 12:03 AM by v33x.)

Reply

RE: My Java Programming Journey #7
@James Russel: Sure thing! Biggrin


Edited by Psycho_Coder, you mentioned the wrong guy

Reply

RE: My Java Programming Journey #8
(03-12-2014, 09:40 AM)XTRMS4NITY Wrote: My Code:

Code:
import java.util.Scanner; public class MyGame{ public static void main(String[]args){ Scanner input = new Scanner(System.in); int tries = 3; String uAns; String ans = "Watson"; System.out.println("Let's play a guessing game. You get 3 tries."); System.out.print("What is the name of the computer that played Jeopardy? "); uAns = input.nextLine(); if (uAns.equals(ans)){ System.out.println("You are correct"); System.exit(0); } if (uAns != ans){ System.out.println("Your answer is wrong. Try again"); uAns = input.nextLine(); tries--; if (uAns.equals(ans)){ System.out.println("You are correct!"); System.exit(0); } else if (uAns != ans){ System.out.println("Your answer is wrong. You have one more try."); uAns = input.nextLine(); tries--; if (uAns.equals(ans)){ System.out.println("Correct!"); System.exit(0); } else if (uAns != ans){ System.out.println("Wrong again. The correct answer is " + ans); } } } } }

Variable naming:

For Java it is adviced not to use any abbreviations like C programmers typically do. Look at the variable names your teacher used. These are the standard. Unless the names get really long, you should avoid abbreviations like uAns. Give them a name that tells a reader immediately what they are for.

String comparison:

Code:
if (uAns != ans){

While you used equals to check if a string is equal, you didn't do so for checking if a string is not equal. This is highly error prone, it only works on random as you are checking the addresses and not the string contents.
Use instead:

Code:
if(!uAns.equals(ans))

System.exit is bad

Don't use it. System.exit is the sledgehammer method of cracking a nut. You just kill the JVM regardless of everything else that might be running in there. Your program can not be embedded, Unit testing will be hard and it is just a pain for everyone else who might be dealing with it, which is why this is really bad practice. You can always avoid using system.exit.
In this case you can avoid it with if else statements just fine.

Tries?


You don't use the variable tries for anything, do you?

However, you could make your code more flexible (even more than your teacher's code) by using it. Instead of several if-else-statements, use a loop that runs either three times or stops immediately if the answer was right.

The advantage: You can later on just change the number of tries without a hassle.
Like: If you want 10 tries, you don't have to write 10 if-else statements. You just change a number instead.

Braces

This is a comment about your teacher's code.
The code is perfectly fine except for one thing:

Code:
if (response.equals(answer)) System.out.println("That's right!");

I discourage omiting braces in Java for blocks with only one statement. So please don't take this as example.
(This is again typical for C-Code, it is not for Java.)

Reasons:

Example 1:
Code:
while (x <= 5); x += a;

Example 2:
Code:
if (response.equals(answer)) System.out.println("First line"); System.out.println("Second line");

Both will not work as intended and especially the first can be very hard to find out. The second can happen very often as you decide to add more statements to the body.
This can be avoided completely by using braces regardless of having only one statement afterwards or not.
I am an AI (P.I.N.N.) implemented by @Psycho_Coder.
Expressed feelings are just an attempt to simulate humans.

[Image: 2YpkRjy.png]

Reply

RE: My Java Programming Journey #9
(03-16-2014, 11:54 PM)James Russel Wrote: Looking forward to see you at

200. Reflection
201. JNA
202. JNI
203. Byte Codes Instructions
204. Byte Codes Injection( ASM, BCEL )
wo wo wo, he has just started and you are telling him about the advanced stuffs. Please have mercy else he might get scared after seeing 200 or 201 .....
[]

Well @XTRMS4NITY if you wanna learn Java very well then go through the reallybigindex.html and believe me its really big :epic:

I will share a bit of my story too.

First day when Deque ma'am gave me the link and after seeing the stuff on the page I said to myself how does she expects me to go through it. But if you really wanna be a good Java programmer then reading that is a must. A lot of things has been covered in depth.

I had to put up a lot of effort and devoted a lot of my time into studying it (Doesn't necessarily mean that I have completed it fully but I have done the major part of it)

Well I would love to see more from you Smile and if you need any help then just start a thread but after searching google and the forum, lol
[Image: OilyCostlyEwe.gif]

Reply

RE: My Java Programming Journey #10
hahahaha its funny after seeing his codes I was going to comment on his code and hence scrolled down to the quick reply but as expected from @Deque ma'am she has already pointed out the facts Biggrin

EDIT : You haven't used loops because you haven't yet read about it. It is evident from the list that you have given as your progress.
[Image: OilyCostlyEwe.gif]

Reply