Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Big HELP!!!!!!!!

  1. #1
    Join Date
    Sep 2012
    Location
    Guntur
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Question Big HELP!!!!!!!!

    Hey guys while i'm studying about java.. i got a few Questions.. It will be very beneficial for me if you guys tell me


    What's the Difference between

    && and &
    || and |

    what's the use of &,|,~,^??

    Why we encounter a error if we write the following code?

    int a=10;
    double b=10.1;
    int c=(b=a)?10:20;
    System.out.println(c);

    How is it possible ??

    byte x=2;
    byte y=4;
    System.out.println(x&y); // why it prints 0 ??
    System.out.println(x|y); // why it prints 6 ??
    System.out.println(x^y); // why it prints 6 ??
    System.out.println(~x); // why It prints -3??


    If so what's the value of (~-2)??
    and how will SHIFT's work

    << SHIFT LEFT
    >> SHIFT RIGHT
    >>> UNSIGNED SHIFT RIGHT

    how come these output's possible??

    System.out.println(2<<1); //why it prints 4 ??
    System.out.println(2<<2); //why it prints 8 ??
    System.out.println(2<<5); //why it prints 64??

    what does 2 and 1 represents??? i mean does the above statement says shift 2 bits to left from 1 or shift 1 bit to left from 2

    If so Does that mean the numbers look like as shown below???

    ......9 8 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 .....
    (OR)
    ......-9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 .....

    Which is correct???

    System.out.println(-1>>5); //why it prints -1 ??
    System.out.println(-1>>>5); //why it prints 134217727 ??

    why we lost data when we are converting from
    int --> float
    long --> float
    long --> double

    like suppose if
    i=85689012
    float f=i;
    why f=8.5689008E7?
    What does that E mean??
    what's the difference between UPPER CASE and LOWER CASE in Floating point Literals??

    63.5D, 4F2C, 3e-1D, 63.5d,4f2c

    what does float f=2.4f21e means??

    Integer Literals are by default 4 types rigt??
    Decimal
    Octal??
    Hexa decimal
    Long literals

    how come 0xE ,0xe, 0x22
    In Hexa Decimal there are alphabets from A to F right??
    What does x means then??
    What are the values of above numbers??

    Can anyone explain these to me i don't understand these at all??
    Last edited by Mohan1289; October 3rd, 2012 at 12:52 PM.

  2. #2
    Join Date
    Nov 2008
    Location
    Lleida, Spain
    Beans
    1,157
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Big HELP!!!!!!!!

    Why we should do your homework?

  3. #3
    Join Date
    Sep 2012
    Location
    Guntur
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Big HELP!!!!!!!!

    Quote Originally Posted by albandy View Post
    Why we should do your homework?
    LOL that's a Good joke
    It's not Home Work albandy

    Those are my doubt's after reading.
    In fact i am an employee not a student.

    I am learning Java recently that's all

  4. #4
    Join Date
    Nov 2008
    Location
    Lleida, Spain
    Beans
    1,157
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Big HELP!!!!!!!!

    What's the Difference between

    && and &
    || and |

    what's the use of &,|,~,^??
    && and &:
    && Logical Opertator (returns true or false)
    & bitwise AND: returns the result of doig an AND operation bit by bit.

    The same with | and ||

    take a look:

    http://www.tutorialspoint.com/java/j..._operators.htm

  5. #5
    Join Date
    Sep 2012
    Location
    Guntur
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Big HELP!!!!!!!!

    Quote Originally Posted by albandy View Post
    && and &:
    && Logical Opertator (returns true or false)
    & bitwise AND: returns the result of doig an AND operation bit by bit.

    The same with | and ||

    take a look:

    http://www.tutorialspoint.com/java/j..._operators.htm
    ummmm.. Sorry albandy in our company they almost blocked all sites except for few.
    I can't open that site

  6. #6
    Join Date
    Apr 2011
    Location
    Maryland
    Beans
    1,461
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Big HELP!!!!!!!!

    In that case, not sure what sites you can visit. Try a Google search for "java boolean operators", and you should get the relevant information. As Albandy says, these are logical Boolean operators (&& = AND, || = OR, etc.).

  7. #7
    Join Date
    Sep 2012
    Location
    Guntur
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Big HELP!!!!!!!!

    I understood the working Logical And(&&) but not Bitwise And(&)

    If you can send me the link i will refer them when i got to home....

    Thank you

  8. #8
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,707

    Re: Big HELP!!!!!!!!


  9. #9
    Join Date
    Jun 2007
    Beans
    322

    Re: Big HELP!!!!!!!!

    You need to read a basic book on data types and programming...

    Some of the things you're asking are too elementary to be explained in a forum question...
    Intel C2D E7200 || Intel DG33FB mobo || 4 GB RAM || 64 bit Lucid/ Precise Desktops || WD Caviar Black 1TB, Green 2TB; Corsair Force 3 60GB
    Dell U2412M || Palit Sonic GT 240 (OC'd NVidia card) || Logitech Quickcam Connect || Acer 3300U Scanner

  10. #10
    Join Date
    Sep 2012
    Location
    Guntur
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Big HELP!!!!!!!!

    may be shreepad i am reading a book but i didn't understand at all that's why i asked in the forum Since you guys are experts in various fields

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •