473,467 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

why we require Class.forName , getConstructor , newInstance methods

5 New Member
i cant able to understand following code , can any one please explain this code

----------------------------------------------------
Class flow = Class.forName("com.test.src");
Constructor flowcons = flow.getConstructor(null);
m_objFlowChartPane = (JComponent) flowcons.newInstance(null);
m_objFlowChartLoad = m_objFlowChartPane.getClass().getMethod("setNode", new Class[] { Vector.class });
return m_objFlowChartPane;
------------------------------------------------------
Mar 9 '12 #1
1 2369
r035198x
13,262 MVP
Why do you need to understand it?
start by reading introductory Java tutorials to understand Java syntax.
Mar 9 '12 #2

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

Similar topics

0
by: Phoneix | last post by:
Hello , I have a necessity to delete a jar file which is in the CLASSPATH. But JVM locks it after a class.forName() call, even though the class loaded is NOT in the JAR file I want to delete. ( I...
16
by: Manuel | last post by:
hi, In the past I made the question "how to implement a simple class forname". I made this finally and it compiled well. but now when i execute the program, it crash with a sigsegv. The code...
2
by: jean-francois | last post by:
In java you can do it with Class.forName("myClass").newInstance(); this will return you a new instance of the class myClass, provided that you defined it elsewhere. How can I get this in c++...
4
by: shed | last post by:
Hi, is there something in javascript like Class.forName in Java? I have the name of my Objectname as String so I can't use the keyword new! Thanks, shed
7
by: Debabrata Jana | last post by:
Dear Friend Please explain the topic--- which one is better to use class.forName or DriverManager.registerDriver at the time when we want to get a connection with database. Please explain it.. ...
1
by: Sergei Riaguzov | last post by:
Is there a way to create an instance of a class SomeClass in PHP having a string "SomeClass"? The idea is to create instances on classes based on dynamic information obtained from $_POST. Like ...
0
mickey0
by: mickey0 | last post by:
Hello, I wrote this and it doens't find the proper path: String userDir = System.getProperty("user.dir"); Class c = Class.forName(userDir + "\\" + "Page"); either: Class c =...
1
by: Max S | last post by:
I have a very large program that loops through about a thousand class strings and does Class.forName(...) on them. It is taking about 100+ milliseconds to execute forName(...) on the classes that...
1
bsadhukhan
by: bsadhukhan | last post by:
When we connect database, we first load driver with code like Class.forName(driverName);. Now forName() has a return of type Class or Object. But we dont keep that return type, we sure that it is in...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.