Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Scope question & shift operators

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

Just want to clear my concept about the shift operators:

If the right hand operand in a shift statement is more than or equal to 32, then to determine the shift distance we mod that operand by 32.e.g.

In all these situations we will mod the right hand operand by 32 to get the shift distance. Am I right??

2. How do we know the scope of an object.

3. The ONLY difference between local and anonymous classes is that the former has a name whereas the latter has no name. Is this statement correct?

Thanks
 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


1. In all these situations we will mod the right hand operand by 32 to get the shift distance. Am I right??


Yes.


2. How do we know the scope of an object.


Large discussion but look at scoping blocks/statements such as for/while/if to determine scope.


3. The ONLY difference between local and anonymous classes is that the former has a name whereas the latter has no name. Is this statement correct?


I wouldn't say that it is the only difference. You cannot declare constructors with anonymous classes.
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think their are some other minor/major differences
1) Anonymous class can only implement (though it cannot use the implements keyword) one interface while local class can more.
2) Anonymous class has to extend already existing class, while local class can be new
3)Anonymous class cannot extend anyother class except Object while implementing interface

I hope this'll help

uzma
 
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic