Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
V

vishaljamdagni

@vishaljamdagni
About
Posts
4
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • What IDE do you use for C/C++ development?
    V vishaljamdagni

    Mostly I use Visual Studio, but once in a while Eclipse too does the job for me.

    C / C++ / MFC c++ visual-studio com question

  • Java Code using the List Interface not Compiling
    V vishaljamdagni

    Hey there, it seems like you're using the wildcard operator "?" and trying to use a method which is modifying the list at the same time. Now I am no expert but I think the above combination cannot be used since if you want to add something to a generic collection then as far as I remember you have to use the "super" keyword with the wildcard operator to let the compiler stop bothering you from adding modifying your collection and with the keyword super you'll have to change the declaration to one hierarchical level lower as well. Hope this helps, pardon me if I got it wrong though. Cheers.

    Java java help

  • Java
    V vishaljamdagni

    It is one of those good practices which you're asked to follow while writing your code because it makes a lot cleaner and concise code. This is similar as to why we programmers focus so much on indentation... Because whenever you're working on a big project chances are you may not be the only person working on it, so if someone else has to review your code it'll be a lot easier for him/her to get a reference as to where was each variable declared. Because you might be well aware of the haunting NullPointerException which just pops out of no where and can be really trick to negotiate if your code isn't clear. Hope this helps. Cheers.

    Java question java

  • What is wrong with this java code, why is it not printing Factorial?
    V vishaljamdagni

    Maybe you shouldn't give the factorial of 1 the value 2 as it is returning in your first "if" construct. Now I am not expert but I think this should work:

    public class facto{
    public static void main(String[] args){
    System.out.println(dust(5));
    }

    static int dust(int n)
    {
    int output;
    if(n==1){
    return 1;
    }

       output = dust(n-1)\* n;
       return output;
    

    }
    }

    I suppose that in your version the recursion is not able to complete properly because of "maybe" your trying to both return the value and calculate it at the same time. Hope the code snippet helps, I am just a beginner myself so apologies if I didn't get it right. P.S I know I haven't considered the condition of the input being 0.

    Java question java
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups