473,385 Members | 1,392 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

confuse with .... public staic Class class

dmjpro
2,476 2GB
we know that the static memeber can be accessed using obj_ref or without obj_ref ......

if i use String.class .... then there is no compiler error ....
but if i use .... String s = new String(); then s.class.... i get an error

why???????

any help is most welcome.
Mar 30 '07 #1
3 1079
JosAH
11,448 Expert 8TB
The .class thingy is not a static method; it's a literal, similar to the .length
literal for arrays. In your example use the object's getClass() method.

kind regards,

Jos
Mar 30 '07 #2
dmjpro
2,476 2GB
one thing let me clearify ... what do u mean by literal?????
Mar 31 '07 #3
r035198x
13,262 8TB
one thing let me clearify ... what do u mean by literal?????
Maybe you really should find time to read those free classes dj.
Mar 31 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Banaticus Bart | last post by:
I wrote an abstract base class from which I've derived a few other classes. I'd like to create a base class array where each element is an instance of a derived object. I can create a base class...
2
by: Burak | last post by:
Hello, I have a web service that has a two user defined public classes. For sake of brevity, I'll write them as follows Public Class Service1 Public Class Class1 Public x as integer End...
4
by: Nick Dreyer | last post by:
Is it possible to see public class variables of a COM addin in Excel 97 VBA? I have successfully created the (Visual Basic 2003 .NET) COM and referenced it in an Excel 97 VBA project. The VBA...
7
by: key9 | last post by:
Hi ALL. Basic Question. sample: class MyClass { ....
4
by: key9 | last post by:
Hi All simple question: 1.==================================== { int* p_1 = new int(); }; //will p1 leak?
5
by: D Witherspoon | last post by:
What is happening is that I have a class (ClassA) that inherits a class (ClassB) which inherits System.Net.Mail.MailMessage Project 1 references Project 2, Project 2 references Project 3. ...
13
by: =?Utf-8?B?bWFyaw==?= | last post by:
Consider this a continuation of 2/27/2007 thread by Zytan entitled"Subject: Does C# have static local variables like C++?" In C++: void mysub() { static double x; blah; blah; }
2
dmjpro
by: dmjpro | last post by:
this is my code ..... class Object1 { private int data; public Object1(int d) { data = d; } public int hashCode()
3
dmjpro
by: dmjpro | last post by:
If a class implements the serializable interface then the class should implement two methods with same signature............. private void readObject(ObjectInputStream in) { //Some code }...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.