Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,848 members, 7,810,267 topics. Date: Saturday, 27 April 2024 at 03:53 AM

How Long Did It Take You Guys To Become Strong Java Programmers - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / How Long Did It Take You Guys To Become Strong Java Programmers (5574 Views)

Help Me Out Java Programmers / Java Programmers ,I Need Help Fixing This Code. / How Are You Guys Coping With International Ban On Cards (2) (3) (4)

(1) (2) (Reply) (Go Down)

How Long Did It Take You Guys To Become Strong Java Programmers by Fulaman198(m): 6:35am On Jan 07, 2016
I just want to check and see everyone's insight on this.
Re: How Long Did It Take You Guys To Become Strong Java Programmers by Dekatron(m): 7:06am On Jan 07, 2016
Looks like I was right in time


Please how do I get input in java??

Like . . I want to accept a string & then print. . . I am confused on the BufferedReading and Scanner.



I did :-

String c1 = getInput("Enter a colour"wink;



It said I should create method getInput(String)


When I did I had :-

private String getInput (String String) {
return null;
}


If I return c1 instead of null, it will accept the String, but won't print. Will just continue accepting



Help me jare. . . Am stuck


cc : fulaman198, teempakguy (oya, Java is here sad sad ), dhtml18 & other guru programmers

1 Like

Re: How Long Did It Take You Guys To Become Strong Java Programmers by ChinenyeN(m): 7:23am On Jan 07, 2016
Honestly, I'm still trying to wrap my mind around Java (I'm going the self-taught route). It's been almost a month now since I started learning, and so far, I've come to understand the logic behind frameworks and packages. I've also come to understand classes and inheritance in Java, but it's taking me longer than I imagined it would to really get a handle on the language. So far, the best I've done, in my self-taught journey is to build a simple package to test out/learn some OOP principles.

I would like to get better with Java though. Overall, I'd say I've made some decent progress in the span of a few weeks of actual learning. Java has a ridiculously steep learning curve. C is so easy compared to this. Anyway, I imagine it would take me more time to become a strong Java programmer, but I believe I can at least get past the learning curve within the next coming months and probably get a good foundation in 3 - 6 months, maybe sooner if I prioritize. I project that I would be strong by the end of the year. It's not to say that I will claim to know the language inside-out, but I will at least be strong enough to know how to use Java to get things done.

1 Like

Re: How Long Did It Take You Guys To Become Strong Java Programmers by ChinenyeN(m): 7:36am On Jan 07, 2016
Dekatron, I think the simplest way would be to just create a new Scanner object.

Scanner in = new Scanner(System.in);
System.out.print("Enter a color: " );
String c1 = in.nextLine();
System.out.println("You entered: " + c1);

This is using java.util.Scanner; class
Re: How Long Did It Take You Guys To Become Strong Java Programmers by omoelu1(m): 7:54am On Jan 07, 2016
what woukd you define as "strong" java programmer
Re: How Long Did It Take You Guys To Become Strong Java Programmers by Fulaman198(m): 8:07am On Jan 07, 2016
Dekatron:
Looks like I was right in time


Please how do I get input in java??

Like . . I want to accept a string & then print. . . I am confused on the BufferedReading and Scanner.



I did :-

String c1 = getInput("Enter a colour"wink;



It said I should create method getInput(String)


When I did I had :-

private String getInput (String String) {
return null;
}


If I return c1 instead of null, it will accept the String, but won't print. Will just continue accepting



Help me jare. . . Am stuck


cc : fulaman198, teempakguy (oya, Java is here sad sad ), dhtml18 & other guru programmers

You have to import a whole new class all together.

import java.util.Scanner

and then create a Scanner object, it's a long process, but it's explained here:

http://www.programmingsimplified.com/java/source-code/java-program-take-input-from-user
Re: How Long Did It Take You Guys To Become Strong Java Programmers by Fulaman198(m): 8:12am On Jan 07, 2016
ChinenyeN:
Honestly, I'm still trying to wrap my mind around Java (I'm going the self-taught route). It's been almost a month now since I started learning, and so far, I've come to understand the logic behind frameworks and packages. I've also come to understand classes and inheritance in Java, but it's taking me longer than I imagined it would to really get a handle on the language. So far, the best I've done, in my self-taught journey is to build a simple package to test out/learn some OOP principles.

I would like to get better with Java though. Overall, I'd say I've made some decent progress in the span of a few weeks of actual learning. Java has a ridiculously steep learning curve. C is so easy compared to this. Anyway, I imagine it would take me more time to become a strong Java programmer, but I believe I can at least get past the learning curve within the next coming months and probably get a good foundation in 3 - 6 months, maybe sooner if I prioritize. I project that I would be strong by the end of the year. It's not to say that I will claim to know the language inside-out, but I will at least be strong enough to know how to use Java to get things done.

Java is not a language that you can just learn in a month sadly. It's one of the more difficult languages and thanks to the fact that various APIs exist, otherwise it would even be more difficult to learn. It takes time, from what I have seen, if you programme in Java for a year, you should be decent at it, but by no means an expert. So I understand exactly what you mean by that my brother. It's definitely not an easy process.

I think you will do fine, I'll keep at it too myself. My goal is to pass the OCA and OCP Java Oracle exams sometime this year (aiming for November). Java is so important because it is what it is used to create Android apps. I would also like to use it to build my own smart house eventually lol.

1 Like

Re: How Long Did It Take You Guys To Become Strong Java Programmers by Intelligentdude(m): 2:33pm On Jan 07, 2016
Fulaman198:


Java is not a language that you can just learn in a month sadly. It's one of the more difficult languages and thanks to the fact that various APIs exist, otherwise it would even be more difficult to learn. It takes time, from what I have seen, if you programme in Java for a year, you should be decent at it, but by no means an expert. So I understand exactly what you mean by that my brother. It's definitely not an easy process.

I think you will do fine, I'll keep at it too myself. My goal is to pass the OCA and OCP Java Oracle exams sometime this year (aiming for November). Java is so important because it is what it is used to create Android apps. I would also like to use it to build my own smart house eventually lol.
Tres bien
Re: How Long Did It Take You Guys To Become Strong Java Programmers by Nobody: 9:24pm On Jan 07, 2016
**just here to troll**

2 Likes

Re: How Long Did It Take You Guys To Become Strong Java Programmers by danidee10(m): 10:56pm On Jan 07, 2016
As a language Java is very big and broad and it takes years....yes years to master it and become proficient in it.....If you've started the journey of java....stick to it and continue your learning process....once you've gotten the basic syntax and can stick different pieces of codes to do something then think of a simple small and fun project that when you think of it in your head you know you can implement it but it's quite tough create it on github and give it your best shot try to follow best practices in java and you're building this project....keep on reading advanced books and apply the knowledge you learn from there to your projects (You can have multiple projects that focus on areas you want to learn, not just one)...that's when you'll find yourself moving from a beginner to intermediate level, at this stage you'll begin to see the reason why you should learn more about algorithms and the best way of doing things in Java....ALGO's are very important

Also go on stackoverflow and see if you can answer questions (That's another good way of learning)....if you can answer a question then you're certainly not a beginner again, they're also many interactive learning sites (thought i don't personally know any for java)

To be a good programmer in general do things like a progammer study how they behave, have a github account, ask and answer questions on stackoverflow and always practice and practice and Remember than Rome wasn't built in a day and always be humble don't ever feel like you're on bad guy or an experienced coder (when you get there your work and people will speak for you)

Ride on bro

5 Likes

Re: How Long Did It Take You Guys To Become Strong Java Programmers by Raypawer(m): 11:23pm On Jan 07, 2016
Good abi strong..
Re: How Long Did It Take You Guys To Become Strong Java Programmers by Fulaman198(m): 6:13am On Jan 08, 2016
danidee10:
As a language Java is very big and broad and it takes years....yes years to master it and become proficient in it.....If you've started the journey of java....stick to it and continue your learning process....once you've gotten the basic syntax and can stick different pieces of codes to do something then think of a simple small and fun project that when you think of it in your head you know you can implement it but it's quite tough create it on github and give it your best shot try to follow best practices in java and you're building this project....keep on reading advanced books and apply the knowledge you learn from there to your projects (You can have multiple projects that focus on areas you want to learn, not just one)...that's when you'll find yourself moving from a beginner to intermediate level, at this stage you'll begin to see the reason why you should learn more about algorithms and the best way of doing things in Java....ALGO's are very important

Also go on stackoverflow and see if you can answer questions (That's another good way of learning)....if you can answer a question then you're certainly not a beginner again, they're also many interactive learning sites (thought i don't personally know any for java)

To be a good programmer in general do things like a progammer study how they behave, have a github account, ask and answer questions on stackoverflow and always practice and practice and Remember than Rome wasn't built in a day and always be humble don't ever feel like you're on bad guy or an experienced coder (when you get there your work and people will speak for you)

Ride on bro

Excellent post.
Re: How Long Did It Take You Guys To Become Strong Java Programmers by Fulaman198(m): 6:13am On Jan 08, 2016
crotonite:
**just here to troll**

As usual right cheesy
Re: How Long Did It Take You Guys To Become Strong Java Programmers by Dekatron(m): 9:50pm On Jan 09, 2016
Hi, fulaman198 and others that did answer



finally, I got it. . . Since the day asked, the chance to program in java came today (am that busy recently)



But I need another answer please :-


I want to set a condition that when I enter a string (red in the case of this specific program), it would terminate if it fufills the condition & proceed if not. . . . I understand I have to use if statement (I knew that since I started learning programming- from FORTRAN to C++, which I dumped). . . But I did assign the if statement. . . My problem is :- I want to set a condition for a STRING nt an int. Hence, I cannot use operators like =,+,> . . . How then do I assign conditions in IF statement without using operators as its not a mathematical condition. Please help.




I wll upload a screenshot (dont mind my task bar o, I un-pin the programs to reduce battery consuption, when not on charging mode. Hence, my empty and boring task bar. grin grin lol)

1 Like

Re: How Long Did It Take You Guys To Become Strong Java Programmers by Fulaman198(m): 9:53pm On Jan 09, 2016
Dekatron:
Hi, fulaman198 and others that did answer



finally, I got it. . . Since the day asked, the chance to program in java came today (am that busy recently)



But I need another answer please :-


I want to set a condition that when I enter a string (red in the case of this specific program), it would terminate if it fufills the condition & proceed if not. . . . I understand I have to use if statement (I knew that since I started learning programming- from FORTRAN to C++, which I dumped). . . But I did assign the if statement. . . My problem is :- I want to set a condition for a STRING nt an int. Hence, I cannot use operators like =,+,> . . . How then do I assign conditions in IF statement without using operators as its not a mathematical condition. Please help.




I wll upload a screenshot (dont mind my task bar o, I un-pin the programs to reduce battery consuption, when not on charging mode. Hence, my empty and boring task bar. grin grin lol)

it will be something like

if StringVariable.equals(String here) {

//enter code segment here

} else {

// Enter more code here


}

1 Like

Re: How Long Did It Take You Guys To Become Strong Java Programmers by Fulaman198(m): 10:02pm On Jan 09, 2016
One thing you have to remember my friend Dekatron is that unlike other primitives (int, long, short, byte, double, etc.) String is not a primitive but an object. Thus, with objects if you want to verify if something is equal you have to use the equal() method.

e.g.

if myString.equals( "Nice job Sam!" ) {
System.out.Println("Your String is " + myString);
} else {
// code goes here
System.out.Println("Your string is interesting" );
}

1 Like

Re: How Long Did It Take You Guys To Become Strong Java Programmers by omoelu1(m): 11:34pm On Jan 09, 2016
and in addition to what Fulaman198 said above,
if you want your program to terminate if the condition is fufilled, do something like this:

if (String variable.equals("red"wink){
###
break;
}
else{
#The code you want executed"
}
Re: How Long Did It Take You Guys To Become Strong Java Programmers by Fulaman198(m): 12:18am On Jan 10, 2016
omoelu1:
and in addition to what Fulaman198 said above,
if you want your program to terminate if the condition is fufilled, do something like this:

if (String variable.equals("red"wink){
###
break;
}
else{
#The code you want executed"
}

Very good, I had no idea there was a code html tag here ROFLLLL. where did you see that?
Re: How Long Did It Take You Guys To Become Strong Java Programmers by Nobody: 9:51am On Jan 10, 2016
Java is one hell of a language.
I'v been learning the language for the past 4months now and i think its not been easy at all. Java syntaxes are unforgiving.
Its gonna take years hardwork for one to become fluent in that language.
The secret is: learn the syntax, build ur own logic.

I love the GUI features alot. Thats the area i wanna dwell on for now.

1 Like

Re: How Long Did It Take You Guys To Become Strong Java Programmers by Fulaman198(m): 11:30pm On Jan 10, 2016
Omagzee:
Java is one hell of a language.
I'v been learning the language for the past 4months now and i think its not been easy at all. Java syntaxes are unforgiving.
Its gonna take years hardwork for one to become fluent in that language.
The secret is: learn the syntax, build ur own logic.

I love the GUI features alot. Thats the area i wanna dwell on for now.

Definitely, Java is a very difficult high-level language like C++. I don't think one can call themselves an expert in the language unless if they have programmed in it for 3 years straight at the minimum. I'm thinking that if I take the Oracle OCA and OCJP and pass them convincingly, I will be more comfortable in my ability to programme in the language.

Java is becoming more and more mainstream, many embedded devices in smart homes are using it now. My goal is that I want to be able to programme all appliances in a house. Call me a nerd, I don't care. But yeah, the code will have to be secure as well. I don't want anything getting hacked. That would be horrible grin. I think that Java may eventually overtake C++, but I know some naysayers who will disagree.

1 Like

Re: How Long Did It Take You Guys To Become Strong Java Programmers by Nobody: 11:06am On Jan 11, 2016
ok, i just started learning java few months ago. i am all on my own though, no friends that are interested in programming, no mentor, no one single programming in my hood.


but i think i am on the right path. pls guys help me verify these (inncomplete exercise) codes of mine:

A company wants to transmit data over the telephone but is concerned that its phones may be tapped. It has asked you to write a program that will encrypt the data so that it may be transmitted more securely. All the data is transmitted as four-digit integers. Your application should read a four-digit integer entered by the user and encrypt it as follows: Replace each digit with the result of adding 7 to the digit and getting the remainder after dividing the new value by 10. Then swap the first digit with the third, and swap the second digit with the fourth. Then print the encrypted integer. Write a separate application that inputs an encrypted four-digit integer and decrypts it to form the original number.



Cypher.java


 public class Cypher
{
int[] key = {3,4,5,6,7,8,9,0,1,2}; //keys to decrpt data
int dig1; //first digit of input/data.
int dig2;
int dig3;
int dig4;
int num; //inputed number.
String enc; //string representation of encrypted input.
String dec; //string representation of decrypted input.


public Cypher( int n){
num = n;
split(n);
}


//function that encrypts input.
public void encrypt(){
dig1 += 7; //increment digit by 7.
dig1 = dig1%10; //remainder after division by 10

dig2 += 7;
dig2 = dig2%10;

dig3 += 7;
dig3 = dig3%10;

dig4 += 7;
dig4 = dig4%10;

swap(1); //swap dig1 and dig3
swap(2); //swap dig2 and dig4
enc = String.format("%d%d%d%d", dig1, dig2, dig3, dig4); //store encrypted digits as string in 'enc'
System.out.println("" + num + "--> " + enc); //print result.
}


//function that splits input into single digits
public void split(int n){
dig4 = n%10;
n = n/10;
dig3 = n%10;
n = n/10;
dig2 = n%10;
n=n/10;
dig1 = n%10;}


//helper function that swaps digits.
public void swap(int n){
int temp;
switch(n){
case 1:
temp = dig1;
dig1 = dig3;
dig3 = temp;
break;
case 2:
temp = dig2;
dig2 = dig4;
dig4 = temp;}}

//funtion that decrypts the encrypted input.
public void decrypt(){
dig1 = key[dig1];
dig2 = key[dig2];
dig3 = key[dig3];
dig4 = key[dig4];

swap(1);
swap(2);

dec = String.format("%d%d%d%d", dig1, dig2, dig3, dig4);
System.out.println("" + enc + "--> " + dec);


}



}





Main.java


 //import java.util.*;

public class Main
{
//this class is incomplete because it does not
//prompt/accept input from the user.

public static void main(String[] args)
{
System.out.println("encrypting input"wink;
Cypher cypher = new Cypher(0004);
cypher.encrypt();
System.out.println("\ndecrypting input"wink;
cypher.decrypt();
}
}




arrrrgh...what a wanton code i have maanged to put togther.

1 Like

Re: How Long Did It Take You Guys To Become Strong Java Programmers by kachnov(m): 12:19pm On Jan 12, 2016
If you are very good with java,why not help teach millions of Nigerian java enthusiasts online while making some income while at it.

See signature.
Re: How Long Did It Take You Guys To Become Strong Java Programmers by khaynoni(m): 8:33am On Jan 15, 2016
crotonite:


arrrrgh...what a wanton code i have managed to put together.


A shorter solution but with a different programming language.



def encrypt():
numbers = "0123456789"
pin = ""
while len(pin) != 4:
pin = raw_input("Enter your 4 digits secret code: "wink

#encrypts the digits

encryptedDigits = []
for digitIndex in range(4):
if pin[digitIndex] in numbers:
encryptedDigits.append(str((int(pin[digitIndex]) + 7) % 10))
else:
return encrypt()
digitIndex += 1

print("Your encrypted digits are {0}{1}{2}{3}".format(encryptedDigits[2], encryptedDigits[3], encryptedDigits[0], encryptedDigits[1]))

encrypt()


def decrypt():
numbers = "0123456789"
pin = ""
while len(pin) != 4:
pin = raw_input("Enter the encrypted digits: "wink
decryptedDigits = []
for digit in pin:
if digit in numbers:
if int(digit) < 7:
decryptedDigits.append(int(digit)+3)
else:
decryptedDigits.append(int(digit)-7)
else:
return decrypt()
#swaps the 1st digit with the 3rd, and the 2nd digit with the 4th.
print("Your decrypted digits are {0}{1}{2}{3}".format(decryptedDigits[2], decryptedDigits[3], decryptedDigits[0], decryptedDigits[1]))
decrypt()


Python
Re: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 12:59pm On Jan 15, 2016
Fulaman198:
One thing you have to remember my friend Dekatron is that unlike other primitives (int, long, short, byte, double, etc.) String is not a primitive but an object. Thus, with objects if you want to verify if something is equal you have to use the equal() method.

e.g.

if myString.equals( "Nice job Sam!" ) {
System.out.Println("Your String is " + myString);
} else {
// code goes here
System.out.Println("Your string is interesting" );
}

Not always true. In the code above, I think that it could be OK to use a simple ==.
Re: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 1:10pm On Jan 15, 2016
I think that it would take at least a couple of years for a natural programmer to become proficient at Java.

I don't think that it is achievable just through book learning and courses. Many of the concepts relate to working in a team. For example, concepts like "visibility" in OOP (Object Oriented Programming) are more clearly demonstrated when working in a team. This is also the case for error handling (exception handling) and so forth. Once you have experience the problems that arise from poor coding technique, either by yourself, or by having to fix somebody else's code, the real meaning and importance of these concepts become apparent, and they stick in your memory!

1 Like

Re: How Long Did It Take You Guys To Become Strong Java Programmers by Fulaman198(m): 4:05pm On Jan 15, 2016
sinequanon:


Not always true. In the code above, I think that it could be OK to use a simple ==.

It does not work that way
Re: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 4:25pm On Jan 15, 2016
Fulaman198:


It does not work that way

Sorry dude, you are wrong.

Pay careful attention. I am saying that it depends on the details. In the scenario given, it depends where myString comes from.
Re: How Long Did It Take You Guys To Become Strong Java Programmers by Fulaman198(m): 4:55pm On Jan 15, 2016
sinequanon:


Sorry dude, you are wrong.

Pay careful attention. I am saying that it depends on the details. In the scenario given, it depends where myString comes from.

Kindly give an example. In Java, String is an object and not a primitive. If I'm wrong, prove it with some sample code. Thanks!
Re: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 5:04pm On Jan 15, 2016
Fulaman198:


Kindly give an example. In Java, String is an object and not a primitive. If I'm wrong, prove it with some sample code. Thanks!

Fair enough.

What I am saying is that the following will output, "Strings ARE equal!"

It is useful to do it this way in SOME cases. If you don't know which cases, and why it works in this case, stick to .equals()

class KindExample{

public static void main(String [] args){

String string1 = "Nice job Sam!";
String string2 = "Nice job Sam!";

if(string1 == string2){
System.out.println("Strings ARE equal!" );
} else {
System.out.println("Strings are NOT equal!" );
}
}
}
Re: How Long Did It Take You Guys To Become Strong Java Programmers by Fulaman198(m): 5:23pm On Jan 15, 2016
sinequanon:


Fair enough.

What I am saying is that the following will output, "Strings ARE equal!"

It is useful to do it this way in SOME cases. If you don't know which cases, and why it works in this case, stick to .equals()

class KindExample{

public static void main(String [] args){

String string1 = "Nice job Sam!";
String string2 = "Nice job Sam!";

if(string1 == string2){
System.out.println("Strings ARE equal!" );
} else {
System.out.println("Strings are NOT equal!" );
}
}
}

The '==' operator tests for object references whereas .equals() tests the string values. E.g.


String myString1 = new String("Nigeria rules!" );
String myString2 = new String("Nigeria rules!" );

// Evaluates to false
myString1 == myString2;

// Evaluates to true
myString1.equals(myString2);

// Evaluates to true, because Java uses the same object
"Football" == "Football";


So that particular example you gave would work however, if you tried this:


String myString1 = "Lagos";
String myString2 = new String ("Lagos" );

(myString1==myString2) //returns false


myString1 is referencing to string in string pool and myString2 is referencing to string in the heap. That's why in regards to Strings, though your example works, if I'm checking for the content in the string, I'll use .equals(). If I'm checking for object equality, I'll use ==

1 Like

Re: How Long Did It Take You Guys To Become Strong Java Programmers by sinequanon: 5:39pm On Jan 15, 2016
Fulaman198:


The '==' operator tests for object references whereas .equals() tests the string values. E.g.


String myString1 = new String("Nigeria rules!" );
String myString2 = new String("Nigeria rules!" );

// Evaluates to false
myString1 == myString2;

// Evaluates to true
myString1.equals(myString2);

// Evaluates to true, because Java uses the same object
"Football" == "Football";


So that particular example you gave would work however, if you tried this:


String myString1 = "Lagos";
String myString2 = new String ("Lagos" );

(myString1==myString2) //returns false


myString1 is referencing to string in string pool and myString2 is referencing to string in the heap. That's why in regards to Strings, though your example works, if I'm checking for the content in the string, I'll use .equals(). If I'm checking for object equality, I'll use ==

I said it works in some situations. You queried this. You were wrong.

Your explanation is not quite right, either. In my example, string1 and string2 are two separate objects.
Re: How Long Did It Take You Guys To Become Strong Java Programmers by ChinenyeN(m): 5:59pm On Jan 15, 2016
Maybe it's just me, but it seems as though both of you just ended up saying/explaining the same thing in the end.

(1) (2) (Reply)

See Money Making Programmers In Nairalans / Dll Load Failure With Py2exe (python And Qt) / Solution To Tokenmismatchexception Problem In Laravel 5.1

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 95
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.