• 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

what is the meaning of String.class ?

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All, I have seen code like String.class is passed to method where mether parameter is string type, like welcomeMsg(String fname, String lname). Istead of passing String type object how can we pass String.class?
Thanks in advance!
 
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
will you please show the code?
 
Ranch Hand
Posts: 448
Eclipse IDE Firefox Browser Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is String.class passed in double quotes ""
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its always recommended to PostRealCode so that we can get more details- How the method is being invoked, method signature.
 
Rajeev roushan sharma
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sunny Bhandari wrote:Is String.class passed in double quotes ""


No, it is not in quotes. if it in quote then it is string right ?
 
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rajeev roushan sharma wrote:Hi All, I have seen code like String.class is passed to method where mether parameter is string type, like welcomeMsg(String fname, String lname). Istead of passing String type object how can we pass String.class?
Thanks in advance!



If the formal parameter type is java.lang.String then the actual parameter type can't be of java.lang.Class<String>.

Maybe you overlooked some overloading?

This thread is in the certification subforum; is this a certification question? If so, please show the source.
 
reply
    Bookmark Topic Watch Topic
  • New Topic