Java Queries Here..

Discussion in 'Programming' started by furious_gamer, Aug 4, 2008.

  1. meetdilip

    meetdilip Computer Addict

    Joined:
    Apr 22, 2009
    Messages:
    1,149
    Likes Received:
    62
    Trophy Points:
    48
    Node JS = Server side JS

    Angular JS = Google made JS framework
     
  2. TheSloth

    TheSloth Don't ban me,pleash (G_G)

    Joined:
    May 24, 2012
    Messages:
    1,486
    Likes Received:
    67
    Trophy Points:
    48
    Location:
    Bed
    For (decent) basic knowledge, JavaBrains on youtube is good. I learned throught that. Someone might know of something better. But they have all tutorials you have mentioned in your post. Good place to start I would suggest.

    I am yet to start JS but as far as I know and heard of, JS is very different from typical OO languages like C++ and Java. Can't really say if hard or not as it depends on person understaking the course , but, people say its hard(well, fu'k'em, you can start if you want, just make sure you start from the first, means, JavaScript). And as dilip mentioned, node.js is for server side. angular is mostly used front end. Really good to have in current market if one wants to be frontend or fullstack developer
     
    quicky008 likes this.
  3. TheSloth

    TheSloth Don't ban me,pleash (G_G)

    Joined:
    May 24, 2012
    Messages:
    1,486
    Likes Received:
    67
    Trophy Points:
    48
    Location:
    Bed
    Hmmm, I should also follow things people are following over stackoverflow, not to give the complete code at firsthand. For future, if anyone is going to ask the code, better post the tries made by you and then we will try to suggest things to improve that code :) . Also, do not hesitate.
     
  4. quicky008

    quicky008 Well-Known Member

    Joined:
    Nov 27, 2007
    Messages:
    1,562
    Likes Received:
    41
    Trophy Points:
    48
    Location:
    Kolkata
    Can anyone tell me what conditions should a class fulfill to be fully encapsulated?Does one need to declare all the class variables as well as methods as private in order to achieve that?Can a class in which the variables have been declared as private but the methods are public be considered encapsulated?
     
  5. Desmond David

    Desmond David Destroy Erase Improve

    Joined:
    Apr 9, 2005
    Messages:
    6,110
    Likes Received:
    124
    Trophy Points:
    63
    Location:
    Pune
    As long as all your class variables are not directly accessible from outside, your class can be considered encapsulated. As per the Javabeans standards, you must define public getter and setter methods to get or set the values of the variables. Also, you must define public methods to operate on your class variables. Your class variables should remain private at all times.
     
    ariftwister, TheSloth and quicky008 like this.
  6. quicky008

    quicky008 Well-Known Member

    Joined:
    Nov 27, 2007
    Messages:
    1,562
    Likes Received:
    41
    Trophy Points:
    48
    Location:
    Kolkata
    i recently installed Eclipse kepler on my system-after installing it i tried launching kepler with my pre-existing workspace that was formerly used with eclipse mars-kepler suggested that i should ├╝pgrade"my workspace to make the workspace files compatible with kepler-however finally when kepler started once the upgrade process finished none of the programs that were in my workspace were working-eclipse shows a red exclamation mark for every line of code in all programs and displays a "jni error"when i try to run them.Can anyone suggest what am i doing wrong?Are the older programs incompatible as they were created using eclipse mars?Is there any way i can fix this issue?
     
  7. TheSloth

    TheSloth Don't ban me,pleash (G_G)

    Joined:
    May 24, 2012
    Messages:
    1,486
    Likes Received:
    67
    Trophy Points:
    48
    Location:
    Bed
    Did you fix the issue?? How did you fix it??
     
  8. quicky008

    quicky008 Well-Known Member

    Joined:
    Nov 27, 2007
    Messages:
    1,562
    Likes Received:
    41
    Trophy Points:
    48
    Location:
    Kolkata
    turns out the version of eclipse that i was using ie kepler didn't support java 8 or higher,i had java 8 installed on my system and so it kept throwing errors and simply refused to work-i finally resolved the issue by installing the latest version of eclipse,that is eclipse O2.
     
    TheSloth likes this.
  9. Desmond David

    Desmond David Destroy Erase Improve

    Joined:
    Apr 9, 2005
    Messages:
    6,110
    Likes Received:
    124
    Trophy Points:
    63
    Location:
    Pune
    You can also install JDK7 parallely with JDK8 and use Kepler with JDK7 if needed.
     
    TheSloth likes this.
  10. quicky008

    quicky008 Well-Known Member

    Joined:
    Nov 27, 2007
    Messages:
    1,562
    Likes Received:
    41
    Trophy Points:
    48
    Location:
    Kolkata
    ^thanks,thats indeed a really useful bit of info-i had no idea that one could use multiple versions of jdk on the same system.
     
  11. quicky008

    quicky008 Well-Known Member

    Joined:
    Nov 27, 2007
    Messages:
    1,562
    Likes Received:
    41
    Trophy Points:
    48
    Location:
    Kolkata
    can anyone help me print this pattern in java:
    (please refer to the image given below):

    p1
     
    Last edited: Jun 7, 2018
  12. Desmond David

    Desmond David Destroy Erase Improve

    Joined:
    Apr 9, 2005
    Messages:
    6,110
    Likes Received:
    124
    Trophy Points:
    63
    Location:
    Pune
    Is this a fixed pattern or does it depend on a configurable number of iterations?

    In either case, you could do something like this:

    Code:
    (pseudocode)
    loop i from 1 to maxIterations
        spaceCount = maxIterations - (i*2);  //Since there are two stars
        loop j from 1 to i
            str = str + "*"
        end loop
        loop j from 1 to spaceCount
            str = str + " "  //append space
        end loop
        loop j from 1 to i
            str = str + "*"  //Ending stars
        end loop
        print str
    end loop
    
    Note that this code does not account for proper conditions for terminating the loop. So I leave that to you to figure out how you want to implement that.

    I would personally prefer to use something like StringBuilder though, instead of appending into string.

    Edit: Also, instead of the middle loop for appending space, I would personally prefer to create a maximum length space string and append a substring of it.
     
    Last edited: Jun 8, 2018
    quicky008 likes this.

Share This Page