Core Java
Java Introduction | OOPS concepts | Casting Operations |
---|---|---|
Java Features Java Drawbacks Golden Tiger wurde im Jahr 2000 gegründet und ist ein beliebtes und angesehenes Online-Casino, das von Tausenden von Spielern besucht wird und in der Community für seine großartige Spielesammlung bekannt ist. Dank der Zusammenarbeit mit einem der führenden Spieleentwickler, Microgaming, lockt das webbasierte Casino die Spieler mit mehr als 500 erstklassigen Spielen unterschiedlicher Arten, Genres und Themen. Glücksspielbegeisterte müssen nicht mehr nach einem landbasierten Casino suchen, um in die Action einzusteigen und eine schöne Partie Roulette, Blackjack oder Poker zu genießen. Was jedoch wirklich beeindruckt, ist die scheinbar unendliche Vielfalt an 3- und 5-Walzen-Spielautomaten, Video- und Power-Poker-Titeln und natürlich die große Auswahl an progressiven Spielen, bei denen Sie eine Auszahlung von Millionen von Dollar genießen können. GoldenTigerCasino ist im Besitz und unter der Leitung von Technology Services Trading Limited und ist Mitglied der angesehenen Casino Rewards Group. Der Betreiber steht auch hinter berühmten Online-Casinos wie Casino Action, Luxury Casino, UK Casino Club und vielen anderen, so dass man mit Sicherheit sagen kann, dass es sich um eine der erfahrensten Glücksspielgruppen der Welt handelt. Alle ihre Websites, einschließlich Golden Tiger, sind dafür bekannt, dass sie sichere Dienstleistungen, professionelle Unterstützung und Kundenzufriedenheit zu jeder Zeit bieten. Um die Spiele zu spielen, können die Spieler entweder eine spezielle Software auf ihren PC oder Mac herunterladen oder das Flash Casino direkt im Browser ihres Computers öffnen. Golden Tiger In Austria ist auch mobil kompatibel, so dass es auf fast allen modernen Smartphones und Tablets verfügbar ist, die auf iOS, Android oder Windows 10 Mobile funktionieren. When choosing an online casino, safety and security should always be top priority. Make sure that any site you plan on playing at has a valid license from a recognized gaming authority such as eCOGRA or UK Gambling Commission (UKGC). Additionally, check to make sure that any personal information you provide is protected by encryption technology and other measures such as two-factor authentication (2FA). Finally, make sure that any transactions made via credit cards or other payment methods are processed securely by reputable payment processing companies such as PayPal or Skrill. Our Au Casinos List partners provide more information here: https://aucasinoslist.com/. |
Data Binding, Hiding, Encapsulation Inheritance Interfaces–Multiple Inheritance View All |
Data Type CastingObject Casting Java int to byte View all |
Packages | Arrays | String & StringBuffer |
Predefined Packages–Java API Creating User-defined Packages Access Specifiers View All |
Arrays Introduction & Properties Jagged Arrays View All |
Introduction – Immutable Nature StringBuffer – Length and Capacity View All |
Exception Handling | IO Streams | Collections Framework (DS) |
Exceptions – Meaning try – catch – finally One stop destination for all Exceptions View All |
Streams – Overview File Copying Keyboard Reading View All |
Stack Vector LinkedList View All |
Multithreading | Applets | Multimedia |
Creating and Spawning Threads Heavy and Lightweight Threads Synchronization View All |
Applets Vs Applications Life Cycle of Applet Drawing Strings & Graphics View All |
Drawing Images Animation and Flickering Multimedia – Image and Animation |
Networking | AWT Graphics | Java Events |
Chat Program (TCP/IP) Echo Server (UDP) URLConnection & URL View All |
Graphics – Introduction Drawing Rectangles (Applet graphics) Drawing Cylinder, Cube, Circle View All |
Java Event Handling View All |
AWT Components | java.lang | java.util |
Button – Learning 8 Steps TextField – Login Screen Validation View All |
Inner classes Garbage Collection class System View All |
class StringTokenizer class GregorianCalendar class Random View All |
Inner classes | Java Reflection API | Annotations |
Inner classes – Introduction Java Nested Classes Nested Interfaces Class inside Interface View All |
Reflection API Retrieve fields with data type Access Specifiers and Modifiers View All |
Annotations Introduction Java Standard Annotations Java Meta Annotations View All |
Java Questions | Java Performance Tuning | Miscellaneous |
Test Your Java 1 Test Your Java 2 Test Your Java 3 View all |
Core Java – 1 JDBC Tuning Servlets & JSP Tuning View All |
Java Conversions Java Comparisons (vs) JDK 1.7 Features JDK 1.8 Features View All |
Advanced Java
Gdy tak się dzieje, zwracamy na to uwagę. Jeśli jest jakiś mniejszy bonus, który można wykorzystać wielokrotnie, często damy mu kredyt. “Znak na stronie” może nie wygląda tak krzykliwie, ale ilość pieniędzy i dolarów bonusowych, które możesz zdobyć w dłuższej perspektywie, sprawi, że będzie to wielka sprawa.Jest to bardzo irytujące, gdy w końcu znajdziesz bonus online, który chcesz tylko dowiedzieć się, że kod lub link nie jest już aktywny. Co gorsza, nie dowiadujesz się o tym aż do momentu, gdy już się zarejestrowałeś lub dokonałeś depozytu na prawdziwe pieniądze i nie masz szczęścia.
Nic nie denerwuje nas bardziej. To właśnie ta wściekłość napędza nas do konsekwentnego testowania i aktualizowania naszej listy największych bonusów online w kasyno polska online. Możesz być pewien, że wszystkie największe bonusy hazardowe online i kody bonusowe, które od nas otrzymasz, będą aktywne i nie wygasną. Otrzymanie bonusów online powinno być łatwe i nie powinno wymagać od ciebie przeskakiwania przez milion obręczy, aby otrzymać to, na co zasługujesz.
Besides having a great time, it’s possible to make a profit playing online casino games. Using the Internet, you can find the best casinos for online gambling in your locale.
To choose the best Aussie casino for you, you will want to consider several factors, including the game’s odds and the type of bonuses offered. A good casino will offer a number of gaming options, with a selection of blackjack, poker, slots and other table games.
The first and most important rule of thumb to follow is to only play at reputable online gambling sites. These will offer top-notch customer support, fast payouts, and a plethora of banking options.
The online casino world is a vast and exciting one. While you may be tempted to try out every site available, you should be sensible and only spend a few dollars at a time. Also, be sure to check the rules of the game before you start betting, as the house may have a different view of the rules of the game.
The iGaming industry has taken off, and new technologies are being introduced to gambling platforms. It’s no secret that the most popular online casino game is blackjack. However, the game isn’t as complicated as it sounds.
PayPal is een veilige en betrouwbare manier om online betalingen te verrichten. Met PayPal kunt u geld storten, geld opnemen en rekeningen betalen. Het is ook heel gemakkelijk in te stellen en te gebruiken. Als u wilt genieten van de voordelen van Paypal casino Nederland zonder uw creditcard te gebruiken, is het misschien tijd om Paypal te bekijken.
Allereerst is het belangrijk om te begrijpen dat het opzetten van een Paypal account gratis is. De dienst brengt echter wel kosten in rekening wanneer u betalingen van andere mensen ontvangt. U moet ook onthouden dat u enkele van uw persoonlijke gegevens moet invoeren om er het meeste uit te halen.
U kunt een persoonlijke of zakelijke rekening bij PayPal krijgen. De zakelijke is ideaal als je een bedrijf hebt. Bovendien biedt de zakelijke rekening meer functionaliteiten, zoals een loyaliteitsprogramma.
Wie online wil betalen, kan kiezen uit een bankrekening, een creditcard of een PayPal-debetkaart. Mogelijk kunt u ook uw bankrekening koppelen aan uw PayPal-rekening.Het is gemakkelijk te begrijpen waarom PayPal zo’n populaire optie is voor zowel consumenten als bedrijven. Het is niet alleen gemakkelijk op te zetten en te gebruiken, het is ook veilig. Niet alleen kunt u veilige transacties maken, maar het zorgt ook voor een veilige en anonieme gokervaring.
Sir,
i have three years of experience providing training of core java, servlet, jsp, I want to switch in development but i don’t have any real time development experience, guide me for that, and how can I go for corporate training. Please help waiting your guidance.
It seems you have institute training experience. As you are in training, you must be very good at subject. Do one or two dummy projects with realtime reflection, keep fake experience (now a day, it is going much) and appear for interviews. Definitely you get job. To join for corporate training, catch one or two consultants. They get. If you would need I get the names of consultants.
Hi Sir ,
I completed SQL part in oracle. should i go for pl/sql part in oracle because i am fresher.
For fresher interviews, it is enough.
Sir, is there any way to see the logic of length() method that java applies on String or write a method to count String length without using any String in-built methods. I have also decompiled the String.class but got nothing as there is no logic given their. I want this logic because as per my knowledge we cannot separate String’s characters without using tocharArray() or charAt() and I don’t want to use any in-built String method for count length of String…. please help me , this is pissing my mind… thanks in advance… will wait for your reply…
Pass the string to a collection class. Collection classes have methods to find the length of an element where element is your string.
Hi Sir ,
this is Vivek. your old student ….
I want to learn advanced Java. So, can you please tell me where you are teaching now ..?
Now I am in USA. I come back in December 15th, Contact me then.
what is different b/w notify() method and notifyall() method
If one thread is wating, JVM calls notify() and more threads are waiting, JVM calls notifyAll().
Class Binding
{
public void final show()
{
/* code
}
public void getInstance(Binding b)
{
b.show();// which binding?
}
}
which binding is determine when the b.show() method call
static or dynamic and why?
As final methods cannot be overridden, JVM prefers to do static binding.
Sir,
I am your old student. I am blessed to see you again as I am far from HYD now and I can contact you through this way.Sir I have doubt can you clear this.
In servlets,
PrintWriter pw = response.getWriter();
response is a reference variable and we cannot call methods by using reference variable as it can hold only address.
Then how can we call getWriter(); using response reference variable?
Thanks in advance.
It is very old question. Reference variable pw is assigned with an anonymous object of PrintWriter returned by getWriter() method.
sir what is the difference between using this() and not using this()?
this() is used to access same class constructor from another constructor.
Read:
http://way2java.com/oops-concepts/constructors/java-constructor-from-constructor/
Hi Sir,
Why Hashtable doesn’t allow key & value as null whereas HashMap allows null key&value atleast once.
please help me.
No answer for this. Most probably designers would like to give different type of storing key/value pairs.
I’ve knowledge in core java but I want to make it more. …Can you please offer online classes to me through skype
Wait for few days. I come with an answer.
Hi Sir,
** Completely am talking about compile time but not runtime**
My doubt is that, how the Object(is also a java) class(specific) methods is available to user defined Test “interface” (am not talking about class) reference ( Here the getClass() method is defined inside Object class, but not declared inside my Test interface even though i am able to access the method on Test reference and no compilation issue, if i call any other method(except Object class method) which is not declared in Test interface (call on Test interface reference) compilation error occurs)
In the below example we can see t.getClass(), in the interface Test no getClass() method is declared even on Test interface reference getClass() method is called i.e defined in Object class, in the same way how could make available User defined class(TestImpl specific methods) methods inside interface Test.
You can see in my previous post, Test interface does not contain any methods and it is not extending any other interface also.
Rule : Methods which are declared inside an interface, we can call only those methods on that interface reference, so you can observer in my example am able to call getClass() method on Test interface reference.
(As per my understanding the methods which are defined in Object class are by default available to every interface and every class, Object class is super class to every java class so by default all the methods which are defined in object class are available for all java class. But i am not clear with how the object class methods getting available to interface ? )
TestImpl.java
==========
public class TestImpl implements Test {
static Test t;
public static void main(String[] args) {
System.out.println(t.getClass()); // Runtime NPE will occure but not compilation error
}
}
Thanks In advance,
AnandRam
Hi Sir,
I am waiting for your response for the above posted question ?
Thanks,
AnandRam.
Hi Sir,
Test.java
=======
public interface Test {
}
TestImpl.java
==========
public class TestImpl implements Test {
static Test t;
public static void main(String[] args) {
t = new TestImpl();
System.out.println(t.getClass());
System.out.println(t.displayName());
}
public String displayName() {
return “way2Java”;
}
}
/*
In the above program we can observer a point, on Test interface reference am able to access getClass() (t.getClass() in this case no compilation issue ) method is defined in Object class, but am not able access displayName() method is defined in TestImpl class (at line number : 7(t.displayName()) am getting compilation error saying “The method displayName() is undefined for the type Test”. My doubt is that, “getClass()” method is not declared inside Test interface, even i am not getting any compilation error, how object class methods are getting available
inside Test interface?
*/
Thanks,
AnandRam
The general rule says “If the super class method is overridden by subclass and also when the super class object is assigned with subclass, the super class object will call subclass overridden method”. On this principle, the dynamic polymorphism works. Now
1. if the super class method is not overridden, the super class object will call its own method.
2. if the super class does not have the method and if the subclass have the method, it is compilation error. This is your problem.
interface Printable{
void print();
}
interface Showable{
void show();
}
class A implements Printable,Showable
{
public void print()
{System.out.println(“Hello”);}
public void show()
{System.out.println(“Welcome”);}
public static void main(String args[])
{
A obj = new A();
obj.print();
obj.show();
}
}
this can be a program to define multiple inheritance with interfaces.
My question was : why we cannot define two different bodies of two different methods ( void print()) of the interfaces Showable and Printable respectively like we did (with print() and show() method) in this program?
How you can override the same method with the same parameters twice in the same class? It becomes duplication and not overloading.
Respected Sir,
The java code below (interface) is the one I have trouble in understanding:
interface Printable{
void print();
}
interface Showable{
void print();
}
class testinterface1 implements Printable,Showable{
public void print(){System.out.println(“Hello”);}
public static void main(String args[]){
testinterface1 obj = new testinterface1();
obj.print();
}
}
My doubt is: when we have two different interfaces which are not connected to each other, rather connected to a common child class (testinterface1) which executes the method void print(), then why don’t we declare the body of two different methods( void print()) of the interfaces Showable and Printable respectively.
Moreover, this make the concept of Multiple Inheritance useless as both the methods are bound to execute same code and thus reduces their functionality.
Kindly, help me to fix this problem.
Thanking you in anticipation,
Ayushi
It is the case with interfaces. If not, tell me how you guess to make multiple inheritance with interfaces.
Hi Sir,
Thank you for giving soon response and i have one more doubt please clarify this also please,
Does an interface extend Object class in java.? if yes how it is possible in java please explain a scenario or if not then why( & how) we can call methods of Object class on interface variable?
Thank you :)
Any interface does not extend a concrete or abstract class. Interface extends another interface only. Give me one example where you called.
Hi Sir,
I didn’t find Setters and Getters tutorial, In the above list
Please explain use of equals() method in comparator interface?
See this link:
http://way2java.com/collections/interface-comparator/
Hi Sir,
why static is not allowed for a constructor? I have gone through your notes in this website but i did not get it. Please explain in a clear cut way.
regards,
Sampath
Static means object not required to call. Is it possible to call the constructor without object?
Thanku sir
The following cannot be abstract:
(Please select ALL that apply)
Select an answer
A. Constructors
B. Static methods
C. Private methods
D. Interface methods
Constructors, static methods and Private methods cannot be abstract.
Sir i request you help me in writing code for below example….
let ‘S’ be class
class S,S1;
S={1,2,3};
S1={4,5,6};
S.chain(S1);
//it should combine two sets into single set ‘S’
Use addAll() method of Collection interface.
Hi Sir,
Can you explain about wait() and notify() methods and why these methods are in object class but not in thread class and explain scenario.
Thank you in advance.
Because every class can use it.
The methods works on the locks and locks are associated with object and not threads.hence ,it is in Object class.
sir please explain about weakhashmap sir
See this link.
http://way2java.com/collections/map/weakhashmap/
Sir,How we can reduce the cpu utilization in java code?
It is in your code. Do not use synchronization when not required. Choose appropriate DS to store your data. Use buffered streams. The only principle is: “give less memory management to the processor to execute your code”. See these links:
http://way2java.com/performance-tuning/core-java-performance-tuning-1/
Hi sir thanks for your great support and work… i got a question asked in an interview can we have ‘private class java if not what is the reason’ please help me sir…
If a class is private, the JVM cannot load your class.
Sir ,can u tell me the sequence of topics to learn java easily?
See this link:
http://way2java.com/java-general/java-for-beginners/
Sir,
I have a doubt that static blocks are executed as part of classloading or after executing the class.
If as part of classloading then is it possible to create object of the class before completion of class loading
when i compaile the following programme i will get an error like “unreachable statment”.
public static void main(String args[])
{
return;
System.out.println(“hai”);
}
when i compaile the following programme i will not get any error.
public static void main(String args[])
{
int a=10;
if(a==10)
return;
System.out.println(“hai”);
}
why did i get error in first programme and why did i not get error in second programme?
Hello sir,
What are the pre-requisites to learn HADOOP/BIGDATA..?
Which institute will give best training..?
Please suggest me and Thankyou very much in advance sir.
Core Java is required. Ameerpet, Hyderabad has lot of institutes. Inquire and join.
Hi Sir,
what is the difference between Comparable and Comparator interface? when should we use Comparable and Comparator?
How compareTo() method performs sorting? Here it compares “this object” with the “passed object”? What is this object here?
please explain in a clear cut way………
Sample:
————-
Employee e1 = new Employee(100,”apple”);
Employee e2 = new Employee(101,”mango”);
Employee e3 = new Employee(102,”pineapple”);
Employee e4 = new Employee(103,”orange”);
ArrayList al = new ArrayList();
al.add(e1);
al.add(e2);
al.add(e3);
al.add(e4);
Regards,
Sampath
this object means with which the method is called.
Read this for differences:
http://way2java.com/collections/comparable-vs-comparator/
I sir,
i want all java package training can you help me.
Join Durga Soft, Maitrivanam building, Ameerpet, Hyderabad.
java is pure oop or not
plz explain with ex…..
There is a big discussion on it.
Hi Sir,
One more doubt is that,
we can achieve immutability using final class and final variables. what is the use of applying private modifiers to the variables?
Please explain me in a clear cut way….Thanks in advance.
regards,
Sampath
For the usage of same class. Private not allowed by composition also.
http://way2java.com/oops-concepts/composition-has-a-relationship/
i want to do real time projects in java..i am btech 2012 passout. sir any good instutute you refer for projects in hyderabad?
Sorry, I am not aware of.
Thnx for this site sir..sir i have completed core java and also studied servlets and JSP..now what should i study next..plz tell me the topics to study nxt and the order in which i should study..
For a fresher, knowledge of Struts and introduction of Hibernate and Spring is enough.
Hi Sir,
Can you provide Spring web application tutorial.
Refer way2java.com
public static void main(String args[])
{
byte b=4;
final byte a=b;
switch(b)
{
case 1:System.out.println(“one”);
break;
case 2:System.out.println(“two”);
break;
case 3:System.out.println(“three”);
break;
case a:System.out.println(“four”);
break;
case 5:System.out.println(“five”);
break;
default:System.out.println(“default”);
}
} when i compiled the above code i got the error like
constant expression required
case a:System.out.println(“four”);
if we declare any variable with final keyword then it is treated as constant but why i got error in the above program sir?
The case values must be either direct int numbers like case 5: or final variable values.
Thank you sir
when i assign a final byte ,final short and final int variables into char variable the program gives no error but when i assign a final long variable into char variable it gives error.why does it give error in case of long?
program 1:in which i didn’t get any error.
public static void main(String args[])
{
final int a=10;
char b=a;
System.out.println(b);
}
program 2:in which i got error.
public static void main(String args[])
{
final long a=10l;
char b=a;
System.out.println(b);
}
Its because char has got a corresponding integer value. Assigning long value is error to an integer value.
Hi sir,
Im a passed out mechanical Engineering Graduate(2014). Im working as an Application Developer. Though im from Mechanical Background, i love programming and im passionate about it. i’ve learned the basics of core java, jsp, servlet in my Training days, and i want to be a java programmer and continue in my career life. i would like to know what would be the future for java programmers., and is there any problem for a mechanical engineer like me in programming world?
Java future is bright. No doubt in that. No problem for any branch of B.Tech. I got students of Oceanography.
sir pls tell some new project ideas that based on java?
That I do not deal.
Sir, I really want to learn java from you. Can you please tell me the name of organization where you teach java.
Config Software Solutions, Chaitanyapuri, Dilsukhnagar, Hyd.
Hello sir…!
What are weak references..?
Can u explain it in detail..?
Please, Thank you verymuch in advance.
Hello Sir, I have some doubts related to yield, join methods. As yield means it causes to pause execution of current Thread and give priority to equal priority Threads for Execution. I got it but In real Life where we can apply Yield method and Join method.
Real life means like static keyword we used when we need to share some common memory space among all the objects.
Same i want to know where we can use these methods yield and join.
Usage of join() is the best programming practice. yield() can be used when you think on your system some tasks are not working.
Hi Sir,
i have Small confusion about what is the Difference between ClassNotFoundException And ClassdefNotfound Exception.
Hello sir,
Why we need to use objects form when data is transmitted on the network…?
Why can’t we use primitive type form..?
To maintain data persistence and object state.
Hi sir,
Thank u so much providing this tutorial.
i was attended many interviews in some interviews they asking what is interface where it is using in real time,
Stringbuffer,serialization,Hashmap, Arraylist, Encapsulation,Vector,.
i need a clarification above topics
Read this about interface realtime exaple:
http://way2java.com/oops-concepts/what-is-interface-in-java-with-realtime-example/
Other things are discussed at relevent topics.
Sir,
Is it possible to restrict user to delete any content of Hard Disk like file,folder using java ?
Yes, deleting/creating file and directory with Java is possible.
sir,plz post all basic programmes of string and array without using inbuilt method….
like1.reverse of string,2.sorting of string, 3.removing char from string,4.duplicate the element of string,5.length of string,6.count total duplicate alphabet of string,7.count total words of string.8 programme of finding even and odd without using any operator.. etc, plz sir post this all as soon as possible,,, i daily refer ur site,,nd mostly concepts i hav learned from ur site….ur site is ULTIMATE sir,,,,u r great person sir,, u doing great job.thank u so much sir,,,,i am waiting for those programmes….
Programs you wanted are given by any C/C++ web site and dealt by a number of blogs. My site deals with Java code. You know Java is simple with its built-in methods. Learn Java. Ofcourse learning the programs you required, increases logic.
sir,no another sites can understand like you,your real time example is mind blowing,before 3 months i didnot know much about JAVA,but when i started to learn about your site,then got real scenario of java,,,thank u so much sir,,
Especially read Arrays and Collections classes. How they decrease your code and prove Java as a “production languages – producing more code in less time”.
http://way2java.com/collections/class-arrays-api-methods/
http://way2java.com/collections/collections-api-methods/
sir,i already read all your concepts,,today i have good knowledge of collections ,string,but sir company ask for simple logics,so sir plzz,post all those programs in java without inbuilt method,i have read collection,and i know where to use which method,sir plzz do something..we all waiting for those programs.
That you get from many web sites; google and find.
Sir,
What is the difference b/w Iterable and Iterator why there are not related to Collection Framework Hierarchy
Because they are not DS, but they are used by DS.
Hi Sir,
I m beginner in java having basic understanding in j2se and also have knowledge of j2ee.
I m confused which framework should I learn which explore my knowledge in web development?
Spring framework.
Sir,
Can we Convert a Swing Application to an executable file and what is the procedure to do that.I have developed an Application in Netbeans 6.9 .Please kindly help me. – See more at: http://way2java.com/view-all/view-all-java-swing-components/#sthash.AoNj5CO5.dpuf
Hi.Can you please explain Web Services also?
Not possible this year.
Sir,
Plez explain below Program how they are communicate and what happen there?
ServletConfig conf=getServletConfig();
ServletContext cont=conf.getServletContext();
When a Web server starts, for the whole application one ServletContext object is created. This works as a global object that can be used by every Servlet of the application. Whenever a Servlet is loaded, while creating a Servlet object, the server also creates a ServletConfig object. A Servlet can access ServletContext object through ServletConfig object. For this reason, getServletContext() object returns an object of ServletContext. That is internally, ServletConfig is connected with ServletContext.
is public static void main(String[ ] arg ) is fixed in main method ?
1. args can be replaced by any identifier.
2. Some compilers accept public static or static public.
sir plzzz…explain the , what is the difference between constructors and initializers with suitable example
Initializers are those where objects and variables are initialized. Constructor in an application is an initializer and init() method in an applet is an initializer. In JavaBean syntax, set methods are initializers.
Sir, iam create a simple registration form in this i have a checkboxes, and dorpdown list, i didnot store checkbox values,and dropdown list values in database by the servlet, so plez tell me how to store checkbox values and dropdown list values in database by the servlet programming. Will you plez explain a simple code for that.
Any GUI like text box, dropdown list, checkbox, radio button, the method in Servlet is getParameter(). Read them from the client, write the JDBC code in service() method, give the values to database.
Sir,
I want to store Multiple values in a database example knownlangauges like english,telugu,hindi thise are the three checkboxes values so i want stored in database. But i am try to store values by the getParameter(),but i donot store three values only single value is stored on database,but i know we have to use getParameterValues() method, i dont no how to use getParameter() method,plez explain about getParameterValues() method and give a simple exple for that.
See this link:
http://way2java.com/servlets/servlets-getparametervalues-example/
Thank you sir.
Hello Sir,
I created a gui application with swing and oracle 10g, it is working in my system, but I want to provide the accessibility of database from the server so I create database on server but now when I am trying to access database with the help of application by providing IP of server in place of @localhost, it throwing an IO exception that network adapter could not establish the connection. please provide me the solution for this issue sir.
It is Oracle installation problem, I think so. Contact a hardware engineer to solve the problem.
which is better for screen development java or oracle forms??
Oracle forms.
plez include File concepts in java…?
You mean these:
File class – Retrieving Metadata of File: http://way2java.com/io/file-class-%e2%80%93-retrieveing-metadata-of-file/
File class – Changing File Properties: http://way2java.com/io/file-class-%e2%80%93-changing-file-properties/
sir,i wont know, why java is platform independent and how, with proper proof and example
See this link:
http://way2java.com/java-introduction/java-features/
How can I send data from servlet to jsp scriptlet?
Using RequestDispatcher.
Sir, i want to know which is better when we compare Java to Ruby on Rails.
Java as object-oriented with better API support.
Hello Sir,
I am working as a Trainer in a company, and want to go in development, please suggest how to switch in development from training if, any also suggest me if about scope in training.
Thanks
Scope of training is very good and ever lasting. You must update your Java knowledge with the time like Hibernate, Spring, Struts, Web services etc. If you very good in these and capable to take laterals, freelancer will be fetching.
sir i want to send collection object from servlet to jsp and access collection in jsp
See these links, you question is answered earlier.
http://stackoverflow.com/questions/12143123/how-can-i-pass-object-from-servlet-to-jsp
http://www.coderanch.com/t/480608/JSP/java/transfer-object-servlet-tp-JSP
etc.
Sir,I want get Installed Antivirus Details in java.Please guide me how it is possible to get any antivirus and is it possible to get its last update date and time.
thank you
Google, you get many free.
Hi Sir,
Myself Manjula from HR Department of Sunera Technolgies.
You have trained our BC1 and BC2 on Java skills, participants were very happy with your teaching.
Now that we have hired next set of Freshers who are from Top Universities. So we would like you to train them on Basic Java and Core Java.
Please reach me on 8008366994
Regards,
Manjula Kolthur
Sunera Technologies
Sir, can I block Particular USB Port by using Java.means I am having 4 ports but I want to enable only one port so how can it will be done .
Is there any way to do so.
Thank You.
I don’t think so, Java can do this. Java is not meant for system programming but meant for production software.
Respected sir,
you are really great one sir. You did me a great favour. I am searching for job from 2 years on java.. actually i don’t have knowledge on it before. even though i went for so many institutes didn’t gain any Knowledge on it. But after learning from your site I’m confident that now i can crack any interviews.
Really Thanks a lot sir.
Sir,
How to Block Particular websites using Java Code ?
Is there any solution for this .Please Reply
Thanks
With the IP address, you can block. Use getRemoteAddr() of Servlets to know the IP address. Then use, sendError() response header to block and send a message to client.
I have a drop down list in an applet.I want to sent the value from applet to servlet when i click on an item in that drop down list. Same way i want to receive an value/data/item from servlet to the same drop down list .Please help me.It’s urgent.
See how this helps you.
Applet to Servlet Communication
Applet to Servlet communication is of 2 types:
1. Text-based communication
2. Object-based communication
1) Text based Communication
It is assumed that there exists a table Employee with following fields:
empid number
empname varchar2(15)
empsal number(6, 2)
The source code involves 3 programs:
1. FetchRecordApplet.hmtl for calling applet
2. FetchRecordApplet.java to display an UI to take user’s input of empid and forward it to the servlet. This UI receives the employee particulars from the servlet and displays them in the text fields.
3. FetchRecordServlet.java to receive data from the applet, search for database Employee table, take the values and send them to the applet.
When you run this program, you may get Security Exception. To overcome this, do the following:
Browser menu bar Tools Internet Options Security Internet Custom Level Miscellaneous Access Data Sources across domains Select enable
Also with
Browser menu bar Tools Internet Options Security Local Intranet Custom Level Miscellaneous Access Data Sources across domains Select enable
1st Program: FetchRecordApplet.html (copy to examplesWebApp)
2nd Program: FetchRecordApplet.java (copy to examplesWebApp)
(for applet file, web.xml file need not be written)
import java.applet.*; import java.awt.*; import java.awt.event.*;
import java.net.*; import java.io.*;
public class FetchRecordApplet extends Applet implements ActionListener
{
TextField idField, nameField, salaryField ;
Button fetchButton ;
public void init( )
{
setLayout(new BorderLayout( ) );
Panel p1 = new Panel( );
p1.setLayout(new GridLayout( 2, 2, 5, 5 ) );
p1.setBackground(Color.cyan);
Panel p2 = new Panel( );
p2.setBackground(Color.pink);
p2.setLayout(new GridLayout( 2, 2, 5, 5 ));
p1.add( new Label(“Enter Employee ID” ));
p1.add( idField = new TextField(15) );
p1.add( new Label(“Click for Details” ));
p1.add( fetchButton = new Button(“Fetch Details” ));
fetchButton.setBackground(Color.yellow);
p2.add( new Label( “Employee Name” ));
p2.add( nameField = new TextField(15));
p2.add( new Label( “Employee Salary” ));
p2.add( salaryField = new TextField(15) );
fetchButton.addActionListener(this);
add(p1, “North”); add(p2, “South”);
}
public void actionPerformed(ActionEvent e)
{
try
{
String str = idField.getText( );
URL u1 = new URL(“http://home:7001/examplesWebApp/
myFetchRecordServlet?t1=”+str);
URLConnection ucon = u1.openConnection( );
InputStream istream = ucon.getInputStream( );
BufferedReader br = new BufferedReader(new
InputStreamReader(istream));
String details[ ] = new String[2];
int i = 0 ;
String str1=””;
while( (str1 = br.readLine( ) ) != null )
{
details[i] = str1 ;
i + + ;
}
br.close( );
nameField.setText(details[0]);
salaryField.setText(details[1]);
}
catch(Exception e1)
{
nameField.setText(“Some Problem” + e1);
salaryField.setText(“Data not received”);
}
}
}
3rd Program: FetchRecordServlet.java (copy to examplesWebApp)
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
public class FetchRecordServlet extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
{
res.setContentType(“text/plain”);
PrintWriter out = res.getWriter( );
String idno = req.getParameter(“t1”);
try
{
Class.forName( “sun.jdbc.odbc.JdbcOdbcDriver” );
Connection con = DriverManager.getConnection(
“jdbc:odbc:snrao”,”scott”,”tiger”);
Statement stmt = con.createStatement( );
ResultSet res1 = stmt.executeQuery(“select *from Employee where
empid=” + idno);
res1.next( );
String name = res1.getString(2);
String salary = res1.getString(3);
out.println(name);
out.println(salary);
out.flush( );
res1.close( ); stmt.close( ); con.close( ); out.close( );
}
catch(ClassNotFoundException e)
{
out.println(“The database driver is not found”);
}
catch(SQLException e)
{
out.println(“Name not found”);
out.println(“Salary not found”);
}
}
}
2. Object-based Communication:
In this objects are passed and retrieved.
The source code involves 3 independent programs.
1st Program: ObjectCommunicationApplet.html
2nd Program: ObjectCommunicationApplet.java ( copy it to the examplesWebApp
directory)
import java.applet.*; import java.awt.*; import java.awt.event.*;
import java.net.*; import java.io.*; import java.util.*;
public class ObjectCommunicationApplet extends Applet implements ActionListener
{
TextField idField, nameField, salaryField ;
Button fetchButton;
public void init( )
{
setLayout(new BorderLayout( ) );
Panel p1 = new Panel( );
p1.setLayout(new GridLayout( 2, 2, 5, 5 ));
p1.setBackground(Color.cyan);
Panel p2 = new Panel( );
p2.setBackground(Color.pink);
p2.setLayout(new GridLayout(2,2,5,5));
p1.add( new Label(“Enter Employee ID” ));
p1.add( idField = new TextField(15) );
p1.add( new Label(“Click for Details” ));
p1.add( fetchButton = new Button(“Fetch Details” ));
fetchButton.setBackground(Color.yellow);
p2.add( new Label( “Employee Name” ));
p2.add( nameField = new TextField(15));
p2.add( new Label( “Employee Salary” ));
p2.add( salaryField = new TextField(15) );
fetchButton.addActionListener(this);
add(p1, “North”); add(p2, “South”);
}
public void actionPerformed(ActionEvent e)
{
try
{
String str = idField.getText( );
URL u1 = new URL(“http://home:7001/examplesWebApp/
myObjectCommunicationServlet”);
URLConnection ucon = u1.openConnection( );
ucon.setUseCaches(false);
ucon.setDoInput(true);
ucon.setDoOutput(true);
ucon.setRequestProperty(“Content-Type”, “application/octet-stream”);
// code to send data(employee id) to the servlet
OutputStream ostream = ucon.getOutputStream( );
ObjectOutputStream oos = new ObjectOutputStream(ostream);
Integer i1 = new Integer( str );
oos.writeObject( i1 );
oos.flush( );
oos.close( );
// code to receive data(employee name and salary) from the servlet
InputStream istream = ucon.getInputStream( );
ObjectInputStream ois = new ObjectInputStream(istream);
// get an object from the servlet that contains the data
Object obj = ois.readObject( );
Vector vect1 = (Vector) obj;
ois.close( );
String name = (String) vect1.elementAt( 0 );
String salary = (String) vect1.elementAt( 1 );
nameField.setText(name);
salaryField.setText(salary);
}
catch(Exception e1)
{
nameField.setText(“Some Problem” + e1);
salaryField.setText(“Data not received”);
}
}
}
3rd Program: ObjectCommunicationServlet.java
import javax.servlet.*; import javax.servlet.http.*; import java.io.*;
import java.sql.*; import java.util.*;
public class ObjectCommunicationServlet extends HttpServlet
{
public void service(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
{
res.setContentType(“text/plain”);
ObjectInputStream ois = new ObjectInputStream(req.getInputStream( ));
ObjectOutputStream oos = new ObjectOutputStream(
res.getOutputStream( ) );
res.setContentType(“application/octet-stream”);
try
{
Integer idno1 = (Integer) ois.readObject( );
String idno = idno1.toString( );
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con = DriverManager.getConnection( “jdbc:odbc:snrao”,
“scott”,”tiger”);
Statement stmt = con.createStatement( );
ResultSet res1 = stmt.executeQuery(“select *from Employee where
empid = ” +idno);
res1.next( );
String name = res1.getString(2);
String salary = res1.getString(3);
Vector vect2 = new Vector( );
vect2.addElement(name);
vect2.addElement(salary);
oos.writeObject(vect2);
res1.close( ); stmt.close( ); con.close( );
}
catch(ClassNotFoundException e)
{
e.printStackTrace( );
}
catch(SQLException e)
{
e.printStackTrace( );
}
}
}
Sir,
What has the bright future in Indian IT job market?(1.Java/Advanced Java or 2.Android)
Java/Adv.java
Sir,
How do I convert .war file into .exe format ?
Hello sir,
i went to a internship test today. there i had a question like this.
Could you please provide your answer?
How many objects created here?
String s1 = new String(“String”);
String s2 = “new”;
String s3 = null;
s1 = “test”;
s2 = s1 + “done”;
s3 = s2 + “”;
testdone
Sir
i don’t understand. i mean whenever we create a String variable or change an existing String variable values, a new String object is created. am i correct? and i answered as 6 (since there are 6 objects created).
if i am wrong, could you please explain little more?
Get me your code please.
Sir this is the question.
How many objects created here?
String s1 = new String(“String”);
String s2 = “new”;
String s3 = null;
s1 = “test”;
s2 = s1 + “done”;
s3 = s2 + “”;
Sir,
I want to prepare for the OCJP Certification please help me and suggest me, how to prepare for that, I dont know what kind of question they asked, please help me.
First solve very simple questions like:
http://way2java.com/java-questions/test-your-java-1/
Choose the version of JDK you want to write the exam.
Then google, you get number of web sites. Solve the questions.
Then, do mock tests available on the sites.
Sir,
How can I get StringTokenizer tokens in a table.
You can use HTML Table or Swing Table.
sir I got a problem in (from HTML page) loading an image from my system into oracle table.
it is unable to read the full path of the file what is the reason..? How can i overcome it please suggest me..?
Here is my code…
NAME
FATHER NAME
DOB
Village/Town/City
District
IMAGE
GENDERMale: Female:
E-MAIL
Give with caution \ (back slashes). Use File class pathSeparator.
Sir,
Do we have generics concept explained in here? I would love to see it here and learn more of it. The way the concepts are presented here are very very useful. Thank you in this regard.
Wait 2 more months. I do this job when I am at leisure.
Sir,Where do I get information about network management system in java in which i have to monitor network computers for unauthorised users,inaccessible media,software upgradation,internet connection ,etc.
please sir help me for that atleast tell me some sites where i get relative code for the same
thank you
If you are at Hyderabad, contact Jetking, Mythrivanam complex.
Sir,I am in Mumbai .can you please help me to get some code so that i can manage by myself to do the application.
Hard copy is available but not soft copy. It is the spiral notes given in the Institute where I teach Java in Hyderabad It costs Rs.350/- including courier charges. If you would like I send.
Sir,What it contains.I mean only idea or full code also for help.
It contains full code (complete programs) with explanation. Best for beginners.
Sir,How to Check at what time the system is shut down and turned on in java ?
Maintain Log file. Many tools give this facility.
Sir,In java how can I get system log off and log on information?
Tools like Eclipse has a provision for this. log() method also available in J2EE coding.
Sir,
How to get IP addresses of all connected computers in network?
I do not have code right now. Give search in Google “how to find the systems connected in the network java” you can find a few answers.
Sir,
How to get IP addresses of all connected computers in network? – See more at: http://way2java.com/#sthash.v6ctGWvx.dpuf
Sir,
How to get IP addresses of all connected computers in network?
Sir, could u plz provide some useful tips and tutorials site where i could learn iOS development and related materials.
I am not aware of.
Hello Sir,
1.) What is the difference between int a=10; and Integer ob=new Integer(10);
2.) In Above example , What s difference between a.equals(ob) & a==ob.
3.) And Also Describe the Pool String Concept & Integer Concept with example ??
You will get reply within three days. Right now I am busy in corporate training.
Hi sir,
To create an immutable class in java, why the class should be declared as final. doesn’t it enough to create the instance variables of that class are final?? please explain me in a clear cut manner…..
Regards,
Sampath Kumar
So that no class can extend and do modification with subclass object.
Hi sir,
String s1 = “apple”;
String s2 = new String(“apple”);
In the first example, one object namely “apple” will get created in the Sting constant pool.
In the second example, two objects will get created. One in String constant pool and other in heap memory.
But the object “apple” is already there in the String constant pool. So my doubt is, does second example again place the “apple” object in the String constant pool .
Hai Sir,
Please provide a page numbers and a key/option to change from one page to another otherwise if we want to read the next topic we should go back and get it which is bit tedious… Page changing option will help a lot to the readers…
Sure. You mean previous page >> or next page <<, like that.
Yes exactly like that.. If I open one unit I should be continuous without coming back to the index and going to next topic by clickking on it.. I expect reading like books..
can u please tell me the differnces between c and java
If you are a C or C++ programmer, you might have found much of the syntax of Java, particularly at the level of operators and statements, to be familiar. Because Java and C are so similar in some ways, it is important for C and C++ programmers to understand where the similarities end. There are a number of important differences between C and Java, which are summarized in the following list:
No preprocessor
Java does not include a preprocessor and does not define any analogs of the define, #include, and #ifdef directives. Constant definitions are replaced with static final fields in Java. (refer java.lang.Math.PI field for an example.) Macro definitions are not available in Java, but advanced compiler technology and inlining has made them less useful. Java does not require an #include directive because Java has no header files. Java class files contain both the class API and the class implementation, and the compiler reads API information from class files as necessary. Java lacks any form of conditional compilation, but its cross-platform portability means that this feature is very rarely needed.
No global variables
Java defines a very clean namespace. Packages contain classes, classes contain fields and methods, and methods contain local variables. But there are no global variables in Java, and, thus, there is no possibility of namespace collisions among those variables.
Well-defined primitive type sizes
All the primitive types in Java have well-defined sizes. In C, the size of short, int, and long types is platform-dependent, which hampers portability.
No pointers
Java classes and arrays are reference types, and references to objects and arrays are same as pointers in C. Unlike C pointers, however, references in Java are entirely opaque. There is no way to convert a reference to a primitive type, and a reference cannot be incremented or decremented. There is no address-of operator like &, dereference operator like * or −>, or sizeof operator. Pointers are a notorious source of bugs. Eliminating them simplifies the language and makes Java programs more robust and secure.
Garbage collection
The Java Virtual Machine performs garbage collection so that Java programmers do not have to explicitly manage the memory used by all objects and arrays. This feature eliminates another entire category of common bugs and all but eliminates memory leaks from Java programs.
No goto statement
Java doesn’t support a goto statement. Use of goto except in certain well-defined circumstances is regarded as poor programming practice. Java adds exception handling and labeled break and continue statements to the flow-control statements offered by C. These are a good substitute for goto.
Variable declarations anywhere
C requires local variable declarations to be made at the beginning of a method or block, while Java allows them anywhere in a method or block. Many programmers prefer to keep all their variable declarations grouped together at the top of a method, however.
Forward references
The Java compiler is smarter than the C compiler, in that it allows methods to be invoked before they are defined. This eliminates the need to declare functions in a header file before defining them in a program file, as is done in C.
Method overloading
Java programs can define multiple methods with the same name, as long as the methods have different parameter lists.
No struct and union types
Java doesn’t support C struct and union types. A Java class can be thought of as an enhanced struct, however.
No enumerated types
Java doesn’t support the enum keyword used in C to define types that consist of fixed sets of named values. This is surprising for a strongly typed language like Java, but there are ways to simulate this feature with object constants.
No bitfields
Java doesn’t support the (infrequently used) ability of C to specify the number of individual bits occupied by fields of a struct.
No typedef
Java doesn’t support the typedef keyword used in C to define aliases for type names. Java’s lack of pointers makes its type-naming scheme simpler and more consistent than C’s, however, so many of the common uses of typedef are not really necessary in Java.
No method pointers
C allows you to store the address of a function in a variable and pass this function pointer to other functions. You cannot do this with Java methods, but you can often achieve similar results by passing an object that implements a particular interface. Also, a Java method can be represented and invoked through a java.lang.reflect.Method object.
No variable-length argument lists
Java doesn’t allow you to define methods such as C’s printf() that take a variable number of arguments. Method overloading allows you to simulate C varargs functions for simple cases, but there’s no general replacement for this feature.
Operators
Java adds a new right shift operator >>> which inserts zeroes at the top end.
The + operator scan be used to concatenate strings.
Java adds another operator instanceof to identify objects.
Operator overloading is not possible in Java.
Classes
Class definitions take the similar form in Java as in C++, but there is no closing semicolon.
There is not scope resolution operator :: in Java.
No destructors in Java
No templates in Java.
Inheritance in Java has the same effect an in C++, but the syntax is different.
Java does not provide direct support for multiple inheritance. We can accomplish
multiple inheritance by using interfaces.
All instance variables have default values
We need not externally define storage for static members like we do in C++.
A class in Java can have an access specifier to determine whether it is visible outside the file.
Arrays
Arrays are quite different in Java. Array boundaries are strictly enforced. Attempting to
read past the end of an array produces an error.
One array can be assigned to another in Java.
Strings
Strings in C/C++ are arrays of characters, terminated by a null character. But strings in
Java are objects.
Strings can be concatenated with + operator.
Differences between C and Java in a nutshell
1. C is a procedural language, Java is object oriented
2. C’s main structuring element are functions in files. Java organizes code in classes and packages, thereby providing better namespaces.
3. C code gets compiled into machine code for a specific CPU. Java code gets compiled into bytecode which is interpreted on a virtual machine (JVM). Java code can get compiled into machine code as well (just-in-time compilers etc.)
4. C does not have exceptions. Errors are handled through return codes.
5. C types like structures (objects without methods) can be allocated on the stack. Java needs to allocate all non-primitives on the heap using expensive memory management functions (e.g. “new”).
6. Arrays and strings in C are not bounds-checked. It is the programmers responsibility to stay within the allocated bounds
7. lets programmers access memory addresses directly through the use of POINTERS. Pointers are variables which contain a memory address. Text (code), data, heap and stack areas are all within a programmers reach. Java lets only the virtual machine access a programs stack, e.g. to perform security checks.
8. Java primitive types are fixed in length. C types can vary per machine. This lets C take maximum use of hardware specifics (e.g. 16 bit register size vs. 32 bit register size). It also creates portability problems.
9. C has a preprocessor and include files. The preprocess works like a macro processor which substitutes macros in the program file.
Top Ten Advantages of Java over C++
Sub-systems can be modelled with packages
Object-oriented systems typically consist of groups of classes, or “sub-systems”, which provide services, rather than a whole bunch of individual classes. The Java package mechanism provides direct support for sub-systems.
All pointer manipulation is done by the compiler
Java takes away the burden of pointer manipulation from the developer. Objects are actually pointers, but there is no need to de-reference objects, take addresses or use a special notation. All that is handled internally by the compiler.
Automatic garbage collection
In C++, the memory for local variables is freed automatically when they go out of scope, but it’s up to developers to free memory which is allocated dynamically. In Java, the run-time system performs automatic garbage collection of dynamically-allocated memory.
No need for header files
C++ classes are typically written in two files: a header file for the class declaration and a separate source file for the implementation. The only use for the header file is so that it can be included in the compilation of other source files which use the class.
Java doesn’t use header files. An entire class is written in a source file. The compiler can look at other files when compiling a class to check function prototypes and access specifiers.
Method functions are “virtual” by default
Designers of a C++ class need to decide which methods could be overriden in the future by derived classes, and declare these methods virtual. In Java, methods are considered virtual by default, unless explicitly declared otherwise. This is more in keeping with the object-oriented principle of keeping derived class information out of base classes.
Rich class library
The standard C++ library is relatively small, consisting mainly of stream operations, plus whatever’s in the C Standard Library. The proposed ANSI standard library adds a lot more functionality, but it’s still some time before it becomes an official standard and becomes supported by all compiler vendors.
Java comes with a rich class library, with support for strings, collection classes, network operations, user interface components, and more.
Robust exception handling
The Java exception mechanism is similar to that in C++, except that Java insists on correct exception specifiers for all functions. This guarantees that the behaviour of a function is predictable because all its exceptions are declared as part of the function declaration.
Standard sizes for basic data types
C++ makes no guarantees about the representation of basic data types. Simple types like int and float are typically implementation based on what’s convenient for the underlying machine. Java specifies standard sizes for its basic data types.
Built-in multi-threading
Java has built-in support for spawning and controlling multiple threads of control in a single process.
Hello sir.
i always wanted to know about callback method? i did a Google search and visited many sites but i didnt get full idea of it.
could you please explain with example?
Thank you
Callback method is that one which is implicitly called by the software, in our case, JVM. Good example is main() method. You write the main() method, are you calling it? No it is called automatically by JVM at the start of execution. main() method is known as callback method.
All applet methods init(), start() etc. are callback methods called by Browser at appropriate times for the smooth execution of applet.
run() method in Thread is callback method.
paint() method is a callback method called implicitly when frame is created or when frame is resized.
In Servlets, service() method is callback method.
Like that many methods are in frameworks like Struts, Spring and Hibernate.
Thank you sir,
I completely understood. So we cannot create call back method but we can override it ?
Sir was i Correct?
You are right to some extent. If you are capable, you too can write.
Hello Sir,
I want a code to insert data in table as well as fetch that data to edit,delete,print in tabular format in struts1.3
Please do not ask me for code. To write the code it takes sometime. But I have got lot of other activities.
I will give an idea. Develop the code slowly; it increases your skills, even though at the beginning it may takes a little bit more time. Write a JDBC code in Action class. To print in tabular form use JSP.
Hi,
When we extend a class, will subclass get a copy of super class? Because how will the superclass members available to subclass when we extend it?
If it is the case, if a class has 10 super classes, then the last subclass will get 10 copies of super classes. Is it not memory and processing waste. I do not think any language designer venture it. Apart each class object pointing the its own variables, it is designed that all the subclass objects also point the same super class variable maintaining encapsulation.
Ok. Thank you.
Hi,
As we know JAVA is platform independent because of JVM. My question is if we would have developed CVM(C Virtual Machine) for C langauage, then we should have had C as a platform independent. Isn’t it? And slight modifications to the C language made C as a JAVA that means all the features of JAVA might have come in C. It would have saved so many things. What do you say? Was it a necessary to develop a new language JAVA?
Your are 100 right in your option. I will say a small example. The Earth gets gravity due to lead (Pb) metal in the earth. Somebody asked Scientist Einstein if all the lead is removed from earth, then the earth looses its gravity and every object floats in the air. Einstein replied yes definitely all objects float. But the Scientist asked, is it possible to remove entire lead from earth? Same answer for your question.
Java was released in 1995, almost 20 years back. But so far no software company (including the software giants like IBM, Microsoft) did not able to develop JVM or nearer to JVM. That is the secrecy of JVM.
A day may come, as you said, every language may becomes platform-independent. But is it possible?
Yes it will possible one day in future. Any way thanks for your answer with an excellent example.
What an excellent explanation it is..!
hai sir
i want features for java1.5 and java1.6 ,and 1.7
JDK 1.5 added feature are very significant to Programmer:
http://way2java.com/java-versions-2/jdk-1-5-java-se-5-version/
JDK 1.6 is not much significant to programmer in real coding as it much deal with memory management and JVM architecture etc:
http://way2java.com/java-versions-2/jdk-1-6-java-se-6-jdk-1-7-versions/
For JDK 1.7:
http://way2java.com/java-versions-2/jdk-1-7-features/
Hi Sir,
byte a=10;
byte b=20;
byte c=a+b;
S.O.P(c);
It is giving me compilation error……But the following program is working well
final byte a=10;
final byte b=20;
byte c=a+b;
S.O.P(c);
please clarify me……..what is the reason behind this
Regards,
Sampath Kumar
Very nice observation and good work while learning Java. In non-final, a+b is evaluated as int value and assigned to byte (requires casting). In final variables, a+b is evaluated as byte and assigned byte.
Thanks for the reply……How come java compiler know it?? pls need detail explanation on it
If it is the case, how Java compiler knows which object is garbage collected in the process? JVM keeps vigil on the process? There are three algorithms here.
Hi all, thanks for sharing ur answers but the fact is that int or smaller mathematical expressions(+,-,*,/ etc) always results to an int. But how the following program works well even if we add two byte non final varibales.
byte a=10;
byte b=10;
a+=b;
S.O.P(a);
Why casting is not necessary here and how come does it perform autocasting?
a += b and a++ make an atomic operation.
a++;
Do we need to write wrapper classes if we use generics?
With generics everything goes smooth. You need not write wrapper objects. It is the purpose of Generics.
Before JDK 1.5 code:
int x = 10;
Integer i1 = new Integer(x);
new Stack().push(i1);
From JDK 1.5:
int x = 10;
new Stack().push(x);
That is difference with Generics feature.
sir ,
i want all tutoriel in the form of pdf .
Sorry, not possible.
Thank you really for all your help. May God bless you more.
Hi Sir,
Recently Java 8 was released.Could you please briefly explain the differences and advancements that are there in java 8.
Thanks in advance.
Regards
Chaitanya Krishna
Sunera Technologies.
See this link:
http://way2java.com/java-versions-2/jdk-1-8-features/
http://way2java.com/java-versions-2/java-lambda-function/
Thank you very much sir..
Hi Sir,
Could u please let me know that if suppose I have the hirarchy like
class a{ Sysout}
class b extends a{ Sysout}
class c extends b{ Sysout}
class d extends c{ Sysout}
and from test class I need to call “a” class method so how to achieve this.
Thanks in advance.
In Test class mian() method, create an object of a and call a class methods.
Good blog for learning Core Java.
Thanks:)
Hello sir,
I really appreciate your work. My request to you is to add SEARCH OPTION in your web site. That will be a great help.
package UserPackage;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class CalculationPage
{
private final String url=”jdbc.odbc:XE”;
private final String user=”system”;
private final String password=”123″;
int amount=0;
String ATName=””;
static
{
try
{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
System.out.print(“driver loaded”);
}
catch(Exception ee)
{
System.out.print(“\nIn calculation java driver “+ee);
}
}
public CalculationPage()
{
System.out.print(“\nObject of CalculationJava class created\n”);
}
public boolean amountCalculation(int AccountNo,String service,int amt)
{
boolean f=false;
try
{
System.out.print(“\nInside amountCAl method 0”);
Connection co=DriverManager.getConnection(url,user,password);
System.out.print(“\nInside amountCAl method 0.6”);
PreparedStatement st1=co.prepareStatement(“select * from INDEXLIST WHERE ACCOUNTNO=?”);
System.out.print(“\nInside amountCAl method 1”);
st1.setInt(1,AccountNo);
ResultSet rs1=st1.executeQuery();
System.out.print(“\nInside amountCAl method 2”);
if(rs1.next())
{
ATName=rs1.getString(“ACCOUNTTABLENAME”);
}
else
{
System.out.print(“Invalid Account”);
}
System.out.print(“\nCode reach till Name “+ATName);
rs1.close();
st1.close();
///taking new entry check it and manipulate
PreparedStatement st2=co.prepareStatement(“select * from “+ATName+” WHERE ACCOUNTNO=?”);
st2.setInt(1,AccountNo);
ResultSet rs2=st2.executeQuery();
if(rs2.next())
{
amount=rs2.getInt(“AMOUNTBALANCE”);
}
System.out.print(“\nCode reach till Name amount 1 “+amount);
rs2.close();
st2.close();
if(service.equals(“Deposit”))
{
amount=amount+amt;
}
else
{
if(amount<=1000)
{}
else
{
amount=amount-amt;
}
}
System.out.print("\nCode reach till Name amount 2 "+amount);
f=true;
co.close();
}
catch(Exception ep)
{
System.out.print("\nIn amountCAlculation Method Error No. "+ep);//1st excception thrown
}
return f;
}
public boolean createEntry(String ser,String WName,int WCIFNo,int WAccountNo,String WSDate,String WSPlace,int WChequeNo,int WDDNo)
{
boolean ce=false;
try
{
Connection co=DriverManager.getConnection(url,user,password);
PreparedStatement st=co.prepareStatement("insert into "+ATName+" VALUES(?,?,?,?,?,?,?,?,?,?,?,?)");
st.setString(1,WName);
st.setInt(2,WAccountNo);
st.setInt(3,WCIFNo);
st.setInt(4,amount);
st.setString(5,ser);
st.setString(6,WSDate);
st.setString(7,WSPlace);
st.setInt(8,0);
st.setInt(9,0);
st.setInt(10,0);
st.setInt(11,WChequeNo);
st.setInt(12,WDDNo);
st.executeUpdate();
ce=true;
st.close();
co.close();
}
catch(Exception e)
{
System.out.print("\nException in data Entry "+e);//2nd excception thrown
}
return ce;
}
}
it is giving /throwing exception both the excetion plzz help me to resolve this exception
I am unable to understand your question.
Could you please one example for abstract class & interface usage?With real time examples!
Why do we need exception handling in java,without that also can implement.
Below snipet. Say array with 10 element
int array[]=new int[10];
to get any element check with its size so we can avoid runtime error,
This is how C-lang manages without exception handling.
Why there should be only one public class per source file, Any technical reason.
Why hashtable wont allows null as key/value but hashmap allows.
1. Because execution starts from public class only.
2. It is the modification did by the designers while implementing HashMap.
Hello sir!
First of all thank you very much for your tutorials.
Actually Hashtable allows null as key. for example we can do like this
Hashtable table = new Hashtable();
table.put(null, new Double(3434.34));
Try like this:
System.out.println(table.get(null));
Does it print 3434.34 or throws NullpointerException.
Following point is given in my notes
Key and value cannot be null and if added, JVM throws NullPointerException.
The above point is given in: http://way2java.com/collections/hashtable-about/
Anyhow, for more clarity, your point I am adding right now. Refer about link, your point is added.
Thank you for your reply sir.
yes you are right. i didn’t think about execution.
Why Constructor name be should be same as class name? Could you explain.
i think its give indication to new operator to Reserved memory for this class.
Student s=new Student();
The method is differentiated from constructor in two respects – by class name and with no return type. Either of these two, anyone misses, it is not constructor. If you want, I will send a program.
1) To read HTML from any website say “http://www.google.com” ( You can use any API of inbuilt APIs in Java like URLConnection )
2) Print on console the HTML from the url above and save it to a file ( web-content.txt) in local machine .
3) JUnit test cases for the above programme.
sir ,first two step completed but help me in third step how to make test case ? please some suggestion is required
thanks
abstract class MainMethodOverloadDemo {
public static void main(String[] args) {
main(10);
/*main(10,12.3f);
main(123.4);
MainMethodOverloadDemo demo=new MainMethodOverloadDemo();
demo.main(20);
demo.main(20, 20.13);
demo.main(123.45);*/
}
static void main(int i)
{
System.out.println(“i=”+i);
}
void main(int j,float f)
{
System.out.println(“j”+j);
System.out.println(“f=”+f);
}
void main(Double d)
{
System.out.println(“d=”+d);
}
}
class A extends MainMethodOverloadDemo
{
A()
{
MainMethodOverloadDemo demo=new A();
demo.main(100);
demo.main(109, 125.67f);
demo.main(123.456);
}
}
Sir,is this program is right and i have to execute class A and call all the methods present in other class
Hello Sir,
can we access main method of abstract class in another general class ?
I have to access all the methods from below program to another class suppose class A,please tell me how to access that methods
abstract class MainMethodOverloadDemo {
public static void main(String[] args) {
main(10);
}
static void main(int i)
{
System.out.println(“i=”+i);
}
void main(int j,float f)
{
System.out.println(“j”+j);
System.out.println(“f=”+f);
}
void main(Double d)
{
System.out.println(“d=”+d);
}
}
Call with class name being static. Non-static, call with subclass object.
package sample_03_03_2014;
abstract class MainMethodOverloadDemo {
public static void main(String[] args) {
main(10);
/*main(10,12.3f);
main(123.4);
MainMethodOverloadDemo demo=new MainMethodOverloadDemo();
demo.main(20);
demo.main(20, 20.13);
demo.main(123.45);*/
}
static void main(int i)
{
System.out.println(“i=”+i);
}
void main(int j,float f)
{
System.out.println(“j”+j);
System.out.println(“f=”+f);
}
void main(Double d)
{
System.out.println(“d=”+d);
}
}
class A extends MainMethodOverloadDemo
{
A()
{
MainMethodOverloadDemo demo=new A();
demo.main(100);
demo.main(109, 125.67f);
demo.main(123.456);
}
}
Sir I have to execute class A,can you please help me for that
Better call MainMethodOverloadDemo.main(10);
i like this post intersting
I was very pleased to discover this web site. I need to to thank you for your time
for this wonderful read!! I definitely really liked every
part of it and I have you saved as a favorite to check out new things on your website.
Dear sir,
Could you please explain me about following 2 programs???
1)int a=5,b=6,c=7;
c=++b+c++;
System.out.println(c);
O/p is 14 but how???
2) float a=2;
if(a==2)
System.out.println(“true”);
else
System.out.println(“false”)
O/P is true=> but how?? a is float type and 2 is integer type.. how it was true??
Your doubts are very simple one. b is pre-incremented and c is post-incremented. Contact your friends or your lecturer to learn pre and post incrementing.
When compared 2 becomes 2.0 internally within parenthesis of if.
Thanks for your response sir,
c=++b+c++; => in this statement 1st b becomes 7 and c(7) both are added and asigned to c ..so c=14,, and again v have c++.. so it wil be like 14++ is equal to 15…..?????????
Dear Sir,
i completed my b.tech(e.c.e) in 2009. i currently working with core related company, i have 3 years of experience in electronics. But now i want to change my carrier field (software).
Sir please suggest me is there any chance to get software job now. can i get good job in 1year?
It will be difficult because 3 years gap is there with Core domain. Try to grow in your own domain.
Is there any facility to courier your study material for people who are outside Hyderabad
Thanks
Sunny Sachdeva
I do not have hard copy of the site.
sir i want code for refreshing a page in servlets for every 2 minutes
Hello sir,
I am very happy for your response….
It is really helping…
Sir, I have a doubt..?
How the below statement is processed…?
int x=-42,y;
y=x>>-2;
what is the value of y?
Thank you in advance sir….
This is right shift operator. Better contact a C/C++ programmer. He is the beset person to explain than me.
sir how to convert image into byte array and store in database.
This is already exists with way2java.
For image writing: http://way2java.com/jdbc/jdbc-image-insert/
For image reading: http://way2java.com/jdbc/jdbc-retrieve-file/
Hi, when i execute below program,
class F
{
final int a;
F()
{
a=10;
}
void display()
{
System.out.println(a);
}
public static void main(String args[])
{
F ob = new F();
ob.display();
}
}
Output is: 10
But when i execute below program,
class F
{
final int a;
F()
{
}
void display()
{
System.out.println(a);
}
public static void main(String args[])
{
F ob = new F();
ob.display();
}
}
Output is: Error why so???
In second program, the constructor should initialize the final variable with it’s default value (i.e 0) in the same way it initializes the instance variable in the first program. But Why error???
Regards,
sampath kumar
Final variables should be given values before they are used.
What is meant by instance initilisation block and it’s rules??
When static initialisation block is useful??
Regards,
sampath
Any block of code used to instantiate an object is known as instantiation block that can be a constructor or any method.
Static block is used to instantiate an object even before main is called. Refer the following link.
http://way2java.com/java-introduction/static-blocks-%e2%80%93-static-initialization/
The static variable gets memory only once in class area at the time of class loading. Here class loading means??
regards,
sampath
When you give the command like “java Demo” from DOS prompt, the Demo.class is loaded from hard disk into the RAM for execution. The is called class loading. To load the .class file, a “class loader” exists in the JDK.
Sir
I am practicing on java string example and want to compress a java string of larger length into smaller one can u please provide me any idea what to do?
thank you in advance
Use ZIP Streams.
Why public class name should be same as the java file name?? When i try to define two classes as public in the same java file, it is throwing following error while compiling…..>Why??
C.java:1: error: class A is public, should be declared in a file named A.java
public class A
^
C.java:15: error: class B is public, should be declared in a file named B.java
public class B
^
2 errors
Regards,
sampath kumar
Java executes from main() method which is described in a public class.
this progarm is for dra a line by user as like ms-paint..
Sir, it is giving null ponter exception plzz help me to remove this exception……
import java.awt.*;
import java.awt.event.*;
public class Project extends Frame
{
Image im;
Graphics gs;
Label locX,locY;
int h,w,x=0,y=0,spX=0,spY=0,epX=0,epY=0;
String msg=””,corX=””,corY=””;
public Project()
{
w = getSize().width;
h = getSize().height;
setForeground(Color.black);
im=createImage(h,w);
gs=im.getGraphics();
gs.setColor(Color.white);
setLayout(new FlowLayout());
locX=new Label();
locY=new Label();
setLayout(new FlowLayout());
addWindowListener(new win());
addMouseListener(new moulist());
addMouseMotionListener(new moumovlist());
add(locX);
add(locY);
}
public class win extends WindowAdapter
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
}
public class moumovlist extends MouseMotionAdapter
{
public void mouseDragged(MouseEvent me)
{
spX=me.getX();
spY=me.getY();
gs.drawLine(spX,spY,epX,epY);
repaint();
}
public void mouseMoved(MouseEvent me) {
x = me.getX();
y = me.getY();
corX=String.valueOf(x);
corY=String.valueOf(y);
locX.setText(corX);
locY.setText(corY);
repaint();
}
}
public class moulist extends MouseAdapter
{
public void mouseClicked(MouseEvent me)
{
x=me.getX();
y=me.getY();
msg=”clicked”;
repaint();
}
public void mousePressed(MouseEvent me)
{
x=me.getX();
y=me.getY();
spX=me.getX();
spY=me.getY();
msg=”pressed”;
repaint();
}
public void mouseReleased(MouseEvent me)
{
x=me.getX();
y=me.getY();
epX=me.getX();
epY=me.getY();
msg=”released”;
repaint();
}
}
public void paint(Graphics g)
{
g.drawString(msg,x,y);
g.drawLine(spX,spY,epX,epY);
g.drawImage(im,0,0,this);
}
public static void main(String args[])
{
Project obj=new Project();
obj.setSize(new Dimension(500,500));
obj.setVisible(true);
obj.setTitle(“hi”);
}
}
In your program lot of mistakes exist like class declarations, using one class variable in another class etc. These are very fundamental mistakes. Take the help of your lecturer.
i need your help pllzz give me the solution of this NullPointerException..its my project….
NullPointerException comes when you use an object without instantiating it. You will be using the reference variable (thinking that it is an object as you must have forgotten to instantiate it). Debugging NullPointerExcetption takes sometime and patience. You must used as in the following link.
http://way2java.com/exceptions/nullpointerexception/
sir,
but same program i’m using in applet it runs withot any exception..error is ocurring frame
as i have to make a windowed program..??
Sir , i have your core java book…you wrote any other book ?
No, please.
Hi,
why can’t we use this keyword in a static method?. please explain it in a clear cut manner.
Regards,
sampath
“this” refers the current object or specific (or particular) object. For example,
public class Demo
{
int x;
public void display(int x)
{
this.x = x;
}
}
Now if you call as d1.dipslay(10), then d1 gets a value of 10 and if you call d2.display(20), d2 gets a value of 20. In first case this refers d1 and in second case this refers d2. If display() is static, display() can be called without the help of an object. See this.
public static void display(int x)
{
this.x = x; // error
}
now I call the method directly as display(100) without the help of an object. Then 100 should be given to which object. You tell me. But this refers always an object. For this reason, this is not allowed from static methods.
Hi,
Why this keyword is not used in a static method?? pls explain in a clear cut manner…..
Regards,
sampath
Hello Sir, I have completed studying core java part but want full in depth about every topic as i dont want to just read every thing just by defination and examples want to learn how to apply this in real time sceniories so please guide me or provide some website for getting in depth information about every topic
Thank you in advance for looking into it.
Your enthusiasm cannot be answered by one web site or one text book. Refer and refer. It is the only way.
sir please send me code in servlets to insert data into database through radiobuttons
Do not anyone to supply code, ask the logic. In the itemStateChanged() method, write JDBC code.
which is the best training institute to learn java in ameerpet
It is, right now, undoubtedly, Durga soft.
sir how to check more than two tables to get data
Use foreign key and write a query with different join statements.
I need adhoc attacks in one simulator can you please help me out
Sorry, I am not.
Sir maine aap se question pucha tha ap jawab nai de rahe ho..plzz rply…is there any Action adapter class or not..???
Pl repeat the question.
is there any ActionAdapter class…….????
Java does not have. Check with .NET
sir is there any solution to use showStatus() method inside Frame……????
No, showStatus() is a method of Applet class. When you want to display a message at the bottom of the frame, you can use a label or textfield.
guide me for developing Report viewing and generation in java standalone application using swing?
Contact your PL.
Hi,
Sir,
Before last six months you had suggested me Java: The Complete Reference for core java. The book is very useful for me and Thank you for the suggestion.
Now I want to learn Servlet so please suggest me good book for beginner . I am in waiting for your reply.
Very shortly by December end, I will put in way2java.com. This month I placed JDBC.
import java.awt.event.*;
import java.awt.*;
public class SimpleInterest extends Frame implements ActionListener
{
Button b;
int x,y,z,ss,aa;
TextField a,p,i,r,t;
public SimpleInterest()
{
addWindowListener(new window());
Label P =new Label(“Principal”);
Label R=new Label(“Rate”);
Label tt=new Label(“Time”);
Label si=new Label(“SI”);
Label A=new Label(“Amount”);
a=new TextField();
p=new TextField(10);
i=new TextField();
r=new TextField(10);
t=new TextField(10);
b=new Button(“Calculate”);
add(b);
add(a);
add(p);
add(i);
add(r);
add(t);
add(P);
add(R);
add(tt);
add(si);
add(A);
//b.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String x1,y1,z1,ss1,aa1;
x1=p.getText();
x=Integer.parseInt(x1);
y1=r.getText();
y=Integer.parseInt(y1);
z1=t.getText();
z=Integer.parseInt(z1);
ss=(x*y*z)/100;
aa=ss+x;
ss1=String.valueOf(ss);
aa1=String.valueOf(aa);
i.setText(ss1);
a.setText(aa1);
}
public class window extends WindowAdapter
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
}
public void paint(Graphics g)
{
}
public static void main(String args[])
{
SimpleInterest ob=new SimpleInterest();
ob.setSize(new Dimension(400,400));
ob.setVisible(true);
ob.setTitle(“Simple Interest”);
}
}
it it showing only amount…why so..
and it want this solution in frame ……plzz
explain…?????
can we use actionAdapter class in inner classes….
plz explain with example…..???
sir i want code for username and password checking from database
Read is record lying with ResultSet object, while reading in the loop, compare the user name and password.
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class AppWindow extends Frame
{
int x,y;
String msg=””;
public AppWindow()
{
addMouseListener(new MyMouseList(this));
addMouseMotionListener(new MyMouseMov(this));
addWindowListener(new WinList(this));
}
public void paint(Graphics g)
{
g.drawString(msg,200,200);
}
public static void main(String args[])
{
AppWindow a=new AppWindow();
a.setSize(new Dimension(600,600));
a.setTitle(“Practice frame”);
a.setVisible(true);
}
}
class MyMouseList extends MouseAdapter
{
AppWindow aa;
public MyMouseList(AppWindow aa)
{
this.aa=aa;
}
public void mousePressed(MouseEvent me)
{
aa.x=me.getX();
aa.y=me.getY();
aa.msg=”Clicked At “+aa.x+”,”+aa.y;
aa.repaint();
}
}
class MyMouseMov extends MouseMotionAdapter
{
AppWindow aa;
public MyMouseMov(AppWindow aa)
{
this.aa=aa;
}
public void mouseMoved(MouseEvent me)
{
aa.x=me.getX();
aa.y=me.getY();
aa.showStatus(“Mouse Moving At ” + aa.x + “,” + aa.y);
}
}
class WinList extends WindowAdapter
{
AppWindow aa;
public WinList(AppWindow aa)
{
this.aa=aa;
}
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
}
plzz resolve the error occurring in aa.showStatus(),…it is saying cannot find symbol
showStatus() is a method Applet and not Frame. So, first convert you application to applet and then debug.
Go to this link for conversion.
Application to Applet
Sir,
I never seen java tutorial like yours. You explained all topics very clear. Only suggestion to you is it would be nice if you maintain index for each topics. For example : if we open collections topic there is no proper order of index like from which link we need to refer in need to start referring collections topics. When i opened collections topic i find difficulty in order to search the initial link from where collections topic begins. I felt like this in all topics. I am sorry if i am wrong. This is the only suggestion i want to give. Remaining all are excellent.
Thanks a lot Sir for making this website. Thanks you so much, this helped me a lot.
You are right. This is pointed out by somebody earlier also. I do the needful within a month.
Thanks a lot Sir for your immediate response. Just now I checked your changes. Now it is good to read. Thanks a lot once again.
Now it is done, to order the contents.
class Dimen
{
int l,b,h;
Dimen(int l,int b,int h)
{
this.l=l;
this.b=b;
this.h=h;
System.out.print(“\nLength = “+l);
System.out.print(“\nBreadth = “+b);
System.out.print(“\nHeight = “+h);
}
}
class vol extends Dimen
{
int volume()
{
return l*b*h;
}
}
public class Inhritence {
public static void main(String[] args)
{
Dimen d=new Dimen(2,3,4);
vol v=new vol();
System.out.print(“\nVolume == “+v.volume());
}
}
Sir,
why this program is giving error…??
if i am using super(2,3,4) in sub class then it is fine why so…??
i want’t breif explanation…..
First add this public Dimen() {} in Dimen class as sub class construct calls super class constructor and is will not be created as you are overloading the constructor.
Second point is the values 2, 3 and 4 belong to d object but not v object. v object takes default 0 values.
“First add this public Dimen() {} in Dimen class”
why so sir..???
subclass constructor, either default or overloaded, will call default constructor of super class. If you overload the constructor, the default will be not created by the system.
sir ,
how we can create executable jar file..and is it necessry that swing is applied in it??
can u give the all details in pdf…my id is [email protected]
Swing is not required.
http://way2java.com/java-lang/jar-java-archive-files/
sir ,
how we can create executable jar file..and is it necessry that swing is applied in it??
can u give the all details in pdf…my id is [email protected]
Hello Sir,
How do i get the hard copy of ur material
Please send details to my mail id
Thanks.
Hard copy is not prepared.
class MyMouseAdapter extends MouseAdapter {
AdapterDemo adapterDemo;
public MyMouseAdapter(AdapterDemo adapterDemo) {
this.adapterDemo = adapterDemo; ///what value this is ssigninig here..???
}
// Handle mouse clicked.
public void mouseClicked(MouseEvent me) {
adapterDemo.showStatus(“Mouse clicked”);
}
}
///plz explain this code sir..??
You are using MouseAdapter class instead of MouseListener. It is required to you to write one more main class AdapterDemo extending Frame. MyMouseAdapter is to be linked to Frame of AdapterDemo.
See this link. It may be helpful to you.
http://way2java.com/awt-components/java-awt-adapters/
Sir please give me the answer..
What is connection pool? and how to manage connection pool in jdbc?
Sir please explain this things with some code..
Thank you in advance
HI can u please help me….
here i just want print only integer value and remove all string value
from list please correct the code…
public class B
{
public static void main(String[] args)
{
List l= new ArrayList();
l.add(1);
l.add(2);
l.add(“e”);
l.add(“aa”);
l.add(4);
System.out.println(l);
}
}
Here is the code.
import java.util.*;
public class B
{
public static void main(String[] args)
{
List l= new ArrayList();
l.add(1);
l.add(2);
l.add(“e”);
l.add(“aa”);
l.add(4);
Iterator it = l.iterator();
while(it.hasNext())
{
if(it.next() instanceof String)
{
it.remove();
}
}
System.out.println(l);
}
}
Thank you sir ……
what is the difference between before and after triggers please could you tell me?
Are you talking about taglibs?
Hi sir
Please tell me what are the access specifiers and access modifiers in java?
Is there any difference between access specifiers and access modifiers?
They are very different. Access specifier specifies the access restriction and access modification modifies the accessibility. For example, default specifier allows to access by the classes of the same package and final modifier for a method, does not allow the subclass to override. They are discussed here:
http://way2java.com/oops-concepts/specifiers-modifiers/access-specifier-vs-access-modifier-in-java/
I am busy, you will get detailed reply by Sunday evening.
Hi. .
Sir I want to join in testing tools course.please suggest me which institute is better for it.
I am not much aware of. Just enquire in Ameerpet.
what is the difference between arr_list & linked _list with code?
This is already discussed in:
http://way2java.com/collections/collections-collections/arraylist-vs-linkedlist/
For programs:
http://way2java.com/collections/arraylist-introduction/
http://way2java.com/collections/linkedlist-tutorial/
what is exactly diff b/w method overloading and over riding?
Method overloading occurs in the same class and method overriding occurs between two classes-super and subclasses. Method overloading leads to static polymorphism and overloading leads to dynamic polymorphism.
sir,
give me………….how to create an employee registration form in “database management system” project with coding ……………………………………using front end java and back end sql……………………………………………………………………………………sir give me one example………………..sir, i was so respectfull to u.
Do no ask anyone code to supply you code. Ask only ideas or how to do. Else when you develop coding skills.
Hi
How to implement single linked list in java using LinkedList class. I have tried but i am not getting it.. Please help me in this regard
regards,
Sampath
Really very nice site S. Nageswara Rao garu! A lot information available in your site.
Advice your friends also to derive knowledge of the site.
why arrayList() store reference why not primitive data type in collections?????
Java DS are designed to store only objects from JDK 1.0 to JDK 1.7 (the latest one). But from JDK 1.5, if you store a primitive data type, it is converted into wrapper object automatically (known as autoboxing).
Sir please provide us some offline materials of you for core java.
Thanks in advance.
I have hard copies. If you are at Hyd meet me.
sir plz send me d oracle download link(for jdbc purpose) and structs download link.I already downloaded some oracle databases bt those are suitable for sql operations only not for jdbc…
There is no separate Oracle for JDBC. Check your driver and syntax of using it.
Can Interface creates any object or reference variable in java?
List list=new ArrayList() vs ArrayList list=new ArrayList(). Could give me some real time examples.
Both ways creation of ArrayList are same.
http://way2java.com/collections/arraylist-introduction/
Hi,
I am getting confused with the following statement.\
Iterator it = al.iterator(); where al is reference to the ArrayList class.\
Could you please explain the above statement in detail
Regards,
Sampath
iterator() method ArrayList (inherited by Collection) returns an object of Iterator. al is the object of ArrayList.
Hi,
Does ArrayList class in java collections, implemants all the methods of an Iterator interface???
Regards,
Sampath
Yes, should be. Infact, ArrayList can use ListIterator also.
How reflections works in java? Cau give real time usages
See this link:
http://way2java.com/reflection-api/retrieve-fields-instance-variables-with-data-type/
collection framework(Data structure) topics can not be found after 1st page(2 to 6 pages are not found),why this problem is happened?
See after (below) comments.
But class seems to can be declared protected in an inner class…….How to access the methods declared in such protected inner classes outside the package???
Regards,
Sampath Kumar
See the link:
http://way2java.com/java-lang/inner-classes/
When I create user defined exception be extending RuntimeException it makes uncheked, If class extends Exception then it makes Checked Exception. How it will JVM understand checked & unChecked when runtimeException extends Exception. Even I saw the both class source code. Nothing much difference.
Could you explain please?
We know Error and RuntimeException (and its subclasses) are unchecked. They are defined in language itself. Checked are those seen with throws in predefined methods.
How to call java methods from oracle database?
It is possible to call. But I have not done it.
Can We write a business logic code at annotations?
@Override its interface, How its check method being overddien properly or not by subclass?
@Override checks the marked subclass method exists in super class or not. With annotations, the EJB methods can be written.
Sir,can Interface(and abstract class also) creates any object?
No we cannot create objects with both abstract class and interface, but we can get objects through their reference variables.
Sir Please guide me
are there better opportunities in java testing and what are the salary range in this line.
and what will be the future?
If you are fresher, join immediately without second thoughts. Fresher is not choosy.
But class seems to have been declared protected in an inner class…….How to access the methods declared in such protected inner classes???
Regards,
Sampath Kumar
Hi,
Can we declare class as protected??? I heard that, we can declare the class as protected but only subclasses are able to create the object for that super class. But when i tried the same, iam getting an erros as “modifier protected not allowed here”. Please explain it???
Regards,
Sampath kumar
A class cannot be protected. A class can be either default specifier or public specifier only.
Good Evening sir,
Is there any possibility to create an object without “new ” key word? why?
Yes, you can create. They are of much theoretical importance. Refer:
http://way2java.com/java-lang/creating-object-without-new-keyword/
for fresher having java knowledge which platform will be better to choose if company is providing option to choose platform for training options in SAP,ORACLE BI and JAVA?
You are accepted for employment and you got choice:
The order is:
1. SAP or Oracle Apps for high salaries
2. Java and if possible with special attention to special tools like TIBCO etc.
3. DBA – last preference
Hello Sir,
Is software job insecure really ?
If no then how can i have a secure life in IT field.
Please Reply Sir…
What you mean by secure? Your job should be guaranteed even when you do not satisfy your employer. In the world, no job is guaranteed. The only difference is software employment does not have any unions or associations to fight against injustice done a software employee where as others has got like banks, LIC has strong unions to fight.
sir,
i have written below program….i got the output But i did not understand it pls tell me
class Request
{
static void disp( )
{
Request r1=new Request();
Request r2=new Request();
System.out.println(r1);
System.out.println(r2);
}
public static void main(String ar[])
{
disp( );
}
}
output:- Request@8193dpme83
Request@4758meple84
Sir, what is the meaning of the output ..?
what it is displaying….?
Please leave comments…
Thanks in advance..
The values represent some address which is not readable.
sir can you please explain me the proper difference between static and final key words briefly
To call a method in Java, you require an object. But to call a static method, you don’t require an object.
final has 3 meanings in 3 places. final variable cannot be reassigned (here, works like const of C), final method in a super class cannot be overridden by its subclass and final class cannot be inherited by another class.
Refer:
http://way2java.com/oops-concepts/static-keyword-%e2%80%93-philosophy/
http://way2java.com/oops-concepts/many-meanings-of-final-keyword-%e2%80%93-in-and-outs/
Hi,
When should we use “throws” keyword. Explain the rules that we need to follow when we use “throws” keyword with awesome examples.
Regards,
Sampath
Read this:
http://way2java.com/exceptions/throwing-with-throws-alternative-to-try-catch/
hi,
Why constructors can not be synchronized and abstract??? Explain with beautiful examples??
First property to be noted is a constructor can not be overridden. If a construct is abstract and if not permitted to override, then what is the use abstract?
If a constructor is synchronized and there by locked by one object, then you cannot create other objects of the class. For this reason, a constructor cannot be synchronized.
Hi,
What is JIT compiler in java?? where does it present??? in JVM or OS???
It is part of JVM. JIT stands for Just-In-Time compiler. Do not misguide by the word compiler. Java’s bytecode conversion to binary code can be treated as another compilation. Here, compilation means format change. JIT compiler preserves the binary code of a method first time when it is called. If called again and again, the same binary code stored earlier is called but does not convert every time when the method is called.
Hi Sir,
What are the actions of Class loader and JVM in java????
Explain in a very clear cut manner??
JDK comes integrated with many components like JVM JRE, Class loader, debugger, bytecode verifier, standard libraries etc.
When a program is compiled, the .class file generated is stored in hard disk. When the class is executed, it must be loaded from the hard disk into the RAM. This is done by the class loader. JVM job is to covert platform independent bytecode into platform dependent binary code(machine code). To execute the program, it requires package classes like System and String etc. These are also loaded. JVM and libraries put together known as JRE (Java Runtime Environment). So basically, JDK comes with a compiler and JRE. Browser contains JRE only but not a compiler because to browser we give pre compiled programs (known as applets).
Sir,
I am a beginner in java when came to “this and super” keywords I confused…why it s used, what is the purpose..? Is it for constructor chaining..? Can you please make me clear…?
Thanks in advance….
In Java there are this, super, this() and super().
1. “this” keyword is used to refer an object
2. “super” keyword is used to call super class variables and methods by the sub class when they are overridden by the subclass.
3. this() is used to access (call) one constructor from another where both constructors belong to the same class.
4. super() is used to access super class constructor from sub class constructor.
A) this() and super() are used with constructors only.
B) super is with variables and methods only
C) this is used with objects only.
Answer is a only. Type the sentence in any main() method and see the output.
class Simple
{
public void finalize()
{
System.out.println(“Object is garbage collected”);
}
public static void main(String args[])
{
Simple ob1 =new Simple();
Simple ob2 =new Simple();
ob1=null;
ob2=null;
System.gc();
System.out.println(“Hello World”);
}
}
I have two Questions on the above program
First: why “Hello World” will get printed first though the garbage collector is called by using System.gc() before printing the “Object is garbage collected” . What’s the reason in spite it is not using any object for printing the message “Object is garbage collected”.
Second: I heard that, finalize() method will be called by the Garbage Collector depending upon the number of unreferenced objects. Here there are 2 unreferenced objects. So, the message “Object is garbage collected” should be displayed twice. But it is displaying the mesaage only once.
I would be very greatful to you, if you clarify me with all the possibilities.
On my system it is printing twice mostly and very less times prints only once. I got JDK 1.7 version.
Hello World is printed first because first preference is given to program execution by the garbage collector. Garbage collection comes into action when the processor is free only (or if no memory is available, it comes into action immediately).
Hi sir,
What does thread occupy the same address space mean?? Hopefully, i will get an answer for the previous post and for this as well…..
Regards,
Sampath Kumar
A thread being an object stored in heap area. Every thread has got its own stack and program counter and these are stored in stack.
Every thread has a reference to the class to which it belongs.
This is general; but each JVM comes with its own implementation of memory. For this, there is no correct answer.
But do not worry much about memory problems and memory is implicitly managed as per JVM architecture. But has a light idea of memory management like constant pools etc.
Java stacks are created private to a thread. Every thread will have a program counter (PC) and a java stack. PC will use the java stack to store the intermediate values, dynamic linking, return values for methods and dispatch exceptions. This is used in the place of registers.
Hi Nageswara Rao,
Do thread occupy stack memory or heap memory? As far as i know, thread occupy heap memory as we are allocating memory using new operator. But i referred some sites and way2java even where it is written as stack memory…..could you please help in this regard???
Regards,
Sampath Kumar
sir, what is the differnce between BuffereReader class and DataInputStreamReader class ?
There is not DataInputStreamReader, it is DataInputStream. The difference between DataInputStream and BufferedReader is, the first one belongs byte streams introduced with JDK 1.0 and the later is character streams introduced with JDK 1.1. The most significant is, the readLine() method of DataInputStream is deprecated but not of BufferedReader.
Sir, I completed MCA in 2009. Now i know core and advanced java…but now i am looking for
job in IT sector. I am in confusion to do either j2ee or any other course….pls suggest me.
For fresher, it is enough. Be perfect with interview questions. Can you answer this question?
The getRequestDispatcher() is returned by both HttpServletRequest and ServletContext. When to use which one?
sir,what is the main use of class “Class”
It is mainly used in Reflection API.
http://way2java.com/reflection-api/
Warm Greetings Sir,
what is the difference in these two?
final x=10; // Constant
static final x=10 // though its a constant
Thanks for your time sir
First correct your question.
1. final int x = 10;
2. static final int x = 10;
In the second statement, the final variable is static. The other methods, can use x without object and at the same time, they cannot change the value.
Sir,will you please guide about concurrency and regular expression in Java?
For concurrency refer:
http://way2java.com/exceptions/concurrentmodificationexception/
For regular expression:
http://way2java.com/string-and-stringbuffer/java-string-replaceall/
and
http://way2java.com/java-versions-2/jdk-1-4-j2se-4-version/
For more on regular expression, refer PERL tutorial. Regular expression concept belongs to PERL language and copied by many languages.
I have a doubt, if the thread of an object instance(say obj) acquires the lock on the object when it goes under the synchronized method(say syncmethod1();), so if a new thread of same object instance(say obj) is trying to access another synchronized method(say syncmethod2();), what will happen? iam thinking the new thread will not be able to access the synchronized method(syncmethod2();) since the lock has not been released yet by the first synchronized method(syncmethod1();)
Why not? Both are different synchronized methods.
if two threads of same obj can access two different synchronized methods, then there is a chance of the object behaviour getting changed in one synchronized method and not getting reflected in another synchronized method, which would result an incorrect output? isnt it? correct me plz if iam wrong
Hello sir,
Plz guide me that where i can find SQL DBA Interview Questions and Answers
Contact the institute where SQL DBA is taught. If yo are at Hyderabad, I can guide you.
Hello sir , this code is showing errors. pls verify n say the correct code:
import java.rmi.*;
public class HelloClient
{
public static void main(String args[]) throws Exception
{
Hello h2=(Hello)Naming.lookup(“roses”);
String s1=h2.sayHello(“nagarjuna”);
System.out.println(s1);
}
}
From your DOS prompt set the classpath like this:
C:\snr> set classpath=c:\snr;%classpath%;,;
Your code is fine. It is only classpath problem.
E:\>javac Hello*.java
HelloClient.java:2: error: class, interface, or enum expected
Public class HelloClient
^
HelloClient.java:4: error: ‘;’ expected
Public Static void main(String args[])throws Exception
^
2 errors
Public class HelloClient
Make P small in Public as public.
Dear sir, could u please answer this
Q:-what have extra significance in interface but not in abstract class?
note:-i know only multiple inheritance,is there other anser.
The answer is in using them. Do you know interface gives a template of methods from which new classes can be developed easily. Interface is used when you want to give full implementation of methods to derived classes. If you would like to a few methods to the derived class to implement use abstract class.
Hi sir,
I am working in a company as a java portal developer.I career i very bad .
i have very poor mark on +2 .I have only 45% mark in my +2.
Will it create any problame further in my future.
Please please replay me sir…..
Less marks scoring will not effect your future career once you gain the experience of 3 years. But what matters is your poor knowledge in the computer subjects and your poor logic. Improve them very fast else you may have to leave the profession.
sir i am preparing for se 7 exam …so i want some sample test or mock tests …so could you please help and can you provide any tests papers of that exam standard
The best is google search. Nothing to beat it.
i hav tried it many sir,,,,but it was not clear or proper anywhere sir
If you are at Hyderabad, I can give some hard copies.
ok sir!!i will collect from you.thanks a lot
public class Odd
{
public static void main(String[] args)
{
http://facebook.com/
System.out.println(“Why is the URL allowed above?”);
}
}
sir please explain this program
What is great in this program? It is simply a println() statement.
i m confuse about http://……/ line but now i got the meaning of this line http: is a label and after // is comment :)
It is a simple program. What is your exact doubt?
import java.util.*;
class Book
{
String name;
int price;
Book(String name, int price)
{
this.name=name;
this.price=price;
}
public String toString()
{
return(name+” “+price);
}
}
class ColletionSortTest
{
public static void main(String… s)
{
ArrayList al=new ArrayList();
al.add(new Book(“Java”,5000));
al.add(new Book(“.Net”,300));
al.add(new Book(“C#”,4000));
al.add(new Book(“Maths”,1200));
Collections.sort(al);
for(ArrayList ob:al) // error class cast Exception Becuase non generic and dwon cast not done here so exception
System.out.println(ob);
}
}
sir ,plz explain the ClassCastException
See this link: http://way2java.com/exceptions/classcastexception/
To work with your code, you must use Comparator or Comparable interfaces to sort the book either on name or price.
http://way2java.com/collections/comparable-example/
http://way2java.com/collections/comparator-example/
Dear Sir,
I am persuing BCA 4th sem from IGNOU. IGNOU’s java book is not good for beginner, so pls tell me best book about java. I want to make career as a java developer so pls tell me java book and its author.
Complete Reference Java (any edition) by Herbt Schiltz of Mc Graw Hill company.
Sir,how i clear the java output screen(like clrscr() and clearDevice() in C)
It is not there in Java. Actually, Java would like you to use GUI. In GUI fields, you can clear all text fields.
Help me to “find the frequency of each word in file?”
First tokenize with StringTokenizer. In a for loop iterate each word and find out the number of time repeated. Counters can be maintained in an array.
sir aggregation and composition is same ? If no then Sir what is aggregation ?
Refer this link for aggregation: http://www.jguru.com/faq/view.jsp?EID=46339
how to count duplicate items in string array?
If you want the total number of duplicate items and not each duplicate item how many times occur, one easy way first find the size of the array, then convert array into HashSet (hash set removes duplicates automatically), find the size of the HashSet, the difference gives the number of duplicates. Else write your own code.
sir,
I want to provide the any practic book pdf (programming problelms) for the related topic wise .
SIR CAN U YOUMAKE ME UNDERSTAND CHECKED EXCEPTION I JAVA
but u told each concept very nice.we ever never forget once we learnt from u
thank you sir…ur really gr8 Person Sir
Sir,
I’m just want to jion hadoobi and i’m having 1 year experiance. Can you please tell me whether it will helpful to my future or not??
Like Apache Hdoop many are technologies, frameworks, ORMs etc. available in the market. If it is required for your job right now, learn it. If not, it is not required because your future project also may not require this.
good evening sir,
I am planning to join selenium testing tool at one of the institute will it help me in getting a job,Is that tool Demand in the market.Can u suggest.
If you are a fresher, nothing extra than Oracle, C,C++ and Java is required.
Sir
i really liked your website, will you please explain the spring and hibernate frame work also.
It is beyond the scope of this web site.
Good Evening Sir,
Sir I am a ex-student of your core java at config.While in the class you repeatedly told that there is a consultancy which provides training to Freshers can u please give the address of that consultancy.I am a 2012 fresher looking for software job.
Thanks in advance.
Meet me in Config.
actually i came to config they told that you are not training in that institute can u tell at what time timings you will be available sir.Thanks in advance
I am available from 6.00 PM to 8.00 PM everyday.
in your materail its mentioned as static methods can use only static variables, but the main method is a static method which uses the non-static variables. Can you explain how is this possible sir?
Thanks in advance!
Static variables do not require object to call from static main() method where as non-static members require object.
static method allows local variables and in main() we use only static or local variables.
just try to use that variables of main() method out side the main they will not be accessible, that means they are local variables.
And static method can use local variables.
sir,String class is immutable we don,t change the value of String after assignment ,but we use
String s=new String(); why ?
hum humare program mae null string kyu use karaegae jismae value hi na ho ?
The statement, String s1 = “hello”; is internally converted into String s1 = new String(“hello”);. Infact, String s1 = “hello”; is a shortcut for String s1 = new String(“hello”);.
Sometimes in coding, local variables should be given values when they are declared. If not, atleast, must be given null, else some compilers raises error.
If you would like to take the value from keyboard at runtime, you must do like this.
String s1 = null;
s1 = “hello” where hello can be taken from keyboard.
sir,can u provide full information about java.lang package i.e about process,process builder,enum….etc
I do not have right now.
Hello sir,
Is there any alternate for sizeof() operator of c in java?
Thank you sir
No. Why you would like to know the size? In C, we require to request the memory. In Java, memory is implicitly managed either creation or removal.
Yes sir if i do not join i will loose experience.But i am tensed that how it adds experience to me ,as it is not used by any other company??Is JAVA and EIFFEL are similar??help me sir!!
Thank you
I told earlier, experience is experience. Both are not exactly similar. But you will have realtime programming experience which is needed after two years to join a new job.
join() release a lock or not?
join() first locks the parent thread for not going for garbage collection. When child thread dies, the lock is released. Everything happens implicitly.
Sir,
I am B.Tech 2012 ECE passout. I got job in platform EIFFEL Programming language.I am unable to understand whether it is useful or not in further ???Please help me sir!!!
Thank you
EIFFEL is an object-oriented language and many of its concepts are taken into Java design. You, being a fresher, do not think whether useful or not. Just work for two years (not only EIFFEL but on any other platform) and later you will have bright future. If you do not join, you may have to spend another year to search for job where you will loose one year experience.
How the Set collection allows no duplicates in java?
You also can write such class with your C/C++ knowledge. For every element added, search for the same element in a for loop that are already existing. Accordingly show error or override.
How hashCode() and equals() work internally in Collection?
internally the content of object is converted into hashcode (hashing).by using euals() method compares two objects
The best answer I have ever seen just check it out
http://way2java.com/java-lang/hashcode-equals-methods/
sir you have mentioned that static blocks execute before main method nd when we run the below program static blocks executes and a error is displayed that main() is missing ,but i am getting only error of missing main() nd static blocks are not executed can u tell me the reason why it is so????
P.S. :: i am using java 1.7
public class MultiStaticBlocks
{
static
{
System.out.println();
System.out.println(“From first static block.”);
}
static
{
System.out.println(“From second static block.”);
}
static
{
System.out.println(“From third static block.”);
}
}
Your code is very correct. Let me try on 1.7 and tell you.
Sir,
I am expecting “Both objects are equal” as the response but I am getting “unequal objects “class testToString. I know the correct answer can come only if we override equals() & hashcode() , but i dont know how to override these methods in this code. Kindly help. Thanks.
{
public static void main(String args[])
{
checkToString cs = new checkToString(2);
checkToString c = new checkToString(2);
if( cs.equals(c))
System.out.println(” Both objects are equal”);
else
System.out.println(” Unequal objects “);
}
}
class checkToString
{
int i;
checkToString()
{
i=10;
}
checkToString(int a)
{
this.i=a;
}
}
i got it sir :-)
sir i have small doubts
1.>why byte code has to interpreted only?why not compiled?
2.>how can jit compiler speed up the interpreting?
3.>where exactly abstract class only used?and where exactly interface only used?
Infact, bytecode to binary code interpretation is nothing but another compilation, in the sense, a compilation results in a different format of code. Example, C/C++ compilation results in binary code and Java results in bytecode. For this reason, some people call Java interpretation is another compilation.
JIT compiler stores a method binary code (when first time the method is called). Subsequently, for every method call, the same already interpreted binary code of the method is called. In JDK 1.0, each time the same method is called, every time the bytecode to binary code is done.
Sir,
what are the boolean data types in java.
is it true and false (or) 0 and 1
It true and false (not 0 and 1). Remember, true and false are not keywords of Java.
sir, tell me main difference between volatile and transient modifiers ?
A variable can be declared as volatile, final and ordinary non-final. They differ lightly in their meaning and more they differ in their performance. transient is used in serialization. transient variables are not serialized. Refer Access Modifiers – Meanings
Sir,
I want to ask 2 questions:
Why static methods does not have “this” ?
Why static methods can not be added into an interface ?
We know when a method is called with an object, the instance variables in the method are linked with the object implicitly and there by encapsulation is maintained (explained in Using Variables from Methods. We also know static method can be called without object also. If called, to what instance variables the object is to be linked. For this reason static methods do not work with this keyword.
If an interface does not permit to override its abstract methods, then there is no meaning and purpose of an interface. by principle, static methods cannot be overridden. For this reason, static methods cannot be added to an interface.
Thank you sir …there are very few people like u who impart education for free with so much dedication .
Can u explain serializable in java?
Please wait for sometime to cover this topic is way2java.com.
what is the difference between an object and a reference variable?
could you please explain with an example..
Demo d1; // here, d1 is reference variable
d1 = new Demo(); // here, d1 is object and memory is allocated.
That is, a reference variable should be converted into object else, it cannot be used to call a variable or method.
Refer Java Reference Variables – Objects – Anonymous objects
can we create the object for the class inside itself
like..
public class TestClass
{
public static void main(String[] args)
{
TestClass firstTest = new TestClass();
firstTest.id = 5;
System.out.println(firstTest.id);
}
}
Yes, no problem.
Yes. If you get a problem, I will send the code.
How many .class files will be created for the following code snippet?
abstract class Shape{
abstract void area();
public void disp(){
System.out.println(“Display Area of Shapes”);
}
}
class Circle extends Shape{
public void area(){
System.out.println(“Display area of Circle”);
}
}
abstract class Draw{
abstract void draw();
}
class Rectangle extends Draw{
public void draw(){
System.out.println(“Draw Rectangle”);
}
}
class Demo{
public static void main(String args[]){
Rectangle obj=new Rectangle();
}
}
Five .class files are created. You can know your answer by compiling the code.
Why Object class is Super class of all class?
Because Java designers thought some methods are useful for every Java program you write. They put all those methods like toString() etc. in Object class and extended implicitly to your class, so that you can make use of all the methods in your code.
sir i dont have program gk so can its better to learn c/c++ else v can start with java .
Learn C and C++ knowledge is not essential.
You can start with Java. As Java follows the same syntax rules and principles of using methods, control structures and arrays, these are not taught by Java lecturers. So better have the knowledge of these topics only in C/C++. Other things of C/C++ are not needed to know.
I am also Java programmer , Really sir i am surprise here , This website is really very very beneficial for every java learner .Because this website cover many topics .
Thank You sir for providing this types of services ..
Thank’s
Manish Kumar…
sir
please tell me which is the best linux for complete java development
like
java jdk,oracle,sql,tomcat,weblogic etc…..
please sir please
i am very confuse about bcoz i’m not finding even one person whoever give me the proper segetion
so please help me
than you
Sir , as we use scanf for input in c .. Can we say tht we r using stream classes to take input from user..
Yes.
Dear Sir,
In Casting Operation Section (http://way2java.com/casting-operations/) page 2 to so on (Page 2, Page 3, Next etc)…not working …Error message Page not found… there is only data type conversion is available but object type or class type conversion is not available…Please help me…
Namaste
Harish
Hi sir what is string constructor in java??
Sir you dont have any book on advanced java
i.e jsp servlet
and on swing framework,
or any reference book you recommend.
At college level, Complete Reference Java is enough. As programmer, you require separate books on each topic. Separate books are available in the market. Choose which you like.
good evening sir, sir i’m very confused in overloaded and override . sir plz tell me with siutable example
It is well discussed in my way2java.com
Sir,
I wanted to join in the course of java,where is your institute located can u send me the address of it.
Sir,
Can plz tell me that when ur going to add adv.java……??
I do it when I am free. Free in my life is a rare commodity.
diff java vs javaw vs javaws
java program for human brain functionality
Sir, i am searching any good book of C and C++ like your core java book…i have your core java book…this is best book of core java…can you tell me any good book name..have you written any c or c++ book…one more thing had you plan to write any other book of java i want to know …because i want to purchase your book for learning purpose
A book on Java script is ready. I am searching for a publisher.
if i want to Publish this ( java script ) book how much expenditure is required
It is not the cost of publishing, it is distribution and advertisement, canvassing etc. that matters.
Hi sir where can i get your books(corejava,java script) and what is the name of the book??
hi sir am waiting for ur reply what is ur java script book name i want to buy it?
It is not Java script book. It is Java text book only on par with “Complete Reference Java” and is everything ready to print. It is not yet published. I am not finding time to search for a publisher.
Sir why java does not support pointers is there any alternative for pointers in java??
just becoz of security reasons becoz in pointer you can access the memory address directly which support hackers to hack or access any data so java encrypt the memory address and then the variable point toward the encrypted address
Last week i was attend one interview he asked to me what’s your project life cycle i told SDLC.. but he was not satisfied … what is means of Project life cycle ?
Refer this link, it may be beneficial to you.
http://www.cio.ny.gov/pmmp/guidebook2/Origination.pdf
Dear Sir,
i was trying to open this site for past 3 days but every-time i got following error….Browser could not find way2java.com
Ping request could not find host way2java.com. Please check the name and try again. is there any problem ?
Many hits are coming to my site. Why not with you? Check your browser settings.
is it possible in java to create instance of interface in case of anonymous inner class?
Anonymous means no object. It is not possible.
Hi sir,
I’m very new in java.. can you help me to solve a problem? i have to find is there any pair of “g” in a given array.. if so then it will return true otherwise false . if all g’s are in pair only then the return will be true .some of the test cases are given :
gPair(“gxxxggxx”)—> false
gPair(“xxggxxggxxx”)—–> true
import java.util.StringTokenizer;
public class Demo
{
public static void main(String[] args)
{
String s1 = “xxgxxxggxxxggxx”;
String s2 = “xxggxxxggxxxggxx”;
String array1[] = s1.split(“[\\w]gg”);
String array2[] = s1.split(“[\\w]g”);
boolean b = false;
if(array1.length == array2.length)
b = true;
System.out.println(“s1 contains only gg: ” + b);
}
}
Repeat the with s2.
sir when u are adding J2ee in this website………. plz sir plz add j2ee also for making this java website complete
Sir
How to change System.out.println() as OurClass.oc.display() ??
I faced this question in interview
You can customize the following code.
import java.io.*;
class YYY
{
public static PrintStream ps = new PrintStream(System.out);
}
public class Demo
{
public void display()
{
YYY.ps.println(“Hello 1”);
}
public static void main(String args[])
{
Demo d1 = new Demo();
d1.display();
}
}
dear can u tell me pls..abstract class cannot be instantiated why?
If given permission to instantiate, you will call abstract methods where there is no output.
why initialization blocks are executed every time whenever a class instance is created
The initialization block is nothing but a constructor. A constructor gives properties to an object at the time of object creation itself. For this, constructor is called every time you create an object. If required, I will send a program to you.
Sir,
how many types of println methods are there which is provided by PrintStream.
println() method is overloaded 10 times in PrintStream class.
Hi sir your site was really good very useful to me i want this data in book can u have any download link please provide me sir am waiting for your reply sir.
I know Java doesn’t support multiple inheritance. But I was asked the following question in an interview
I have two classes with one method in each
classA{
public void x(){}
}
classB{
public void y(){}
}
I want to access these two methods in classC
classC{
public void x(){}
public void y(){}
}
How to do this Java. Please explan
Thanks in advance
I came up with the following solution for my earlier question. Please give your feedback on the given solution
public class ClassA{
public void flying(){
System.out.println(“Flying…”);
}
}
public class ClassB{
public void floating(){
System.out.println(“Floating…”);
}
}
public class MyClass{
ClassA ia;
ClassB ib;
public MyClass(){
ia = new ClassA();
ib = new ClassB();
}
public void printMessage(){
ia.flying();
ib.floating();
}
public static void main(String[] args){
MyClass mc = new MyClass();
mc.printMessage();
}
}
What you have done is composition (has-a relationship)
Use multilevel inheritance as follows.
class A{
public void x(){}
}
class B extends A {
public void y(){}
}
class C extends B { }
Could you please explain the reason for ConcurrentModificationException and how to avoid it?
See this link:
http://way2java.com/exceptions/concurrentmodificationexception/
To avoid it, do not modify the DS data with ListIterator.
pls tell me sir about abstract class
abstract class can’t instantiated why?pls explain it sir..
Hello Sir,
please tell me core java design pattern name which used most in Core Java Project ?
Creational Patterns
Singleton
Factory
Factory Method
Abstract Factory
Builder
Prototype
Object Pool
Behavioral Patterns
Chain of Responsibility
Command
Interpreter
Iterator
Mediator
Memento
Observer
Strategy
Template Method
Visitor
Null Object
Structural Patterns
Adapter
Bridge
Composite
Decorator
Flyweight
Proxy
Singleton, factory, factory method, iterator, observer, composite, decorator.
Thank You Sir .. :)
Can u explain about Java matches sir
import java.awt.*;
import java.awt.event.*;
public class Radio extends Frame implements ItemListener
{
Checkbox c1,c2,c3,c4,c5,c6;
Panel p1,p2;
TextField tf;
CheckboxGroup cbg1,cbg2;
public Radio()
{
p1.setLayout(new GridLayout(1,3,15,10));
p1=new Panel();
p2=new Panel();
cbg1=new CheckboxGroup();
cbg2=new CheckboxGroup();
p1.setBackground(Color.pink);
p2.setBackground(Color.blue);
c1=new Checkbox(“HeroHonda”,cbg1,true);
c2=new Checkbox(“Bajaj”,cbg1,false);
c3=new Checkbox(“Tvs”,cbg1,false);
c4=new Checkbox(“Black”,cbg2,false);
c5=new Checkbox(“Maroon”,cbg2,false);
c6=new Checkbox(“Silver”,cbg2,false);
p1.add(c1);
p1.add(c2);
p1.add(c3);
p2.add(c4);
p2.add(c5);
p2.add(c6);
add(p1,”north”);
add(p2,”south”);
add(tf=new TextField(15),”centre”);
tf.setBackground(Color.cyan);
tf.setFont(new Font(“Monospaced”,Font.BOLD,18));
c1.addItemListener(this);
c2.addItemListener(this);
c3.addItemListener(this);
c4.addItemListener(this);
c5.addItemListener(this);
c6.addItemListener(this);
addWindowListener(new CloseMe());
setSize(450,350);
setVisible(true);
}
public void ItemStateChanged(ItemEvent e)
{
String str1=””, str2=””;
if(c1.getState()==true)
{
str1=”Famous Hero Honda”;
}
else if(c2.getState()==true)
{
str1=”Hamara Bajaj”;
}
else if(c3.getState()==true)
{
str1=”The Great TVS”;
}
if(c4.getState()==true)
{
str2=”Black”;
}
else if(c5.getState()==true)
{
str2=”Maroom”;
}
else if(c6.getState()==true)
{
str2=”Silver”;
}
tf.setText(“Good Taste, U want “+str1+”in”+str2);
}
public static void main(String args[])
{
new Radio();
}
class CloseMe extends WindowAdapter
{
public void WindowClosing(WindowEvent e)
{
System.exit(0);
}
}
}
ERROR:Radio is not abstract and does not override abstract method ItemStateChanged(java.awt.event.ItemEvent) in java.awt.event.ItemListener. could you pls solve ot for me sir…
regards
aravind
public void ItemStateChanged(ItemEvent e)
The above statement is error. ItemStateChanged should be itemStateChanged.
Is it a good practice to convert checked exception to runtime exception?
Never. If you convert, one disadvantage the problem goes unchecked until executed.
When should use externalizable interface? Please provide example or case.
To customize serialization.
Which exception is caught first? IOException or FileNotFoundException? Could you please specify reason?
It depends on the catch blocks sequence.
hello sir ..
I am really glad after knowing about the site . I have heard about u when i was in hyderabad last year searching for a job.Unfortunately i didnt get much oppertunity over there .Its so nice of u that u have mentained such a nice website for java lovers. I want to do my career in java .So I need some guidance from u .Would u like to help in in this regard . I know core java,jdbc,servlet and jsp well .What more i need to know about java so as to become a good java proffessional .Help me sir .
There are two answers – write me whether you are already employed or searching for job.
Good Morning sir,
i have one question… suppose i have two list with duplicate elements i want to print one unique list via these two list…how can i write this program
import java.util.*; al1 = new ArrayList (); al2 = new ArrayList ();
public class Demo
{
public static void main(String args[])
{
ArrayList
ArrayList
al1.add(10); al1.add(20); al1.add(30); al1.add(20); // 20 repeated
al2.add(40); al2.add(30); al2.add(40); al2.add(50); // 40 repeated; 30 exists in both lists
al1.addAll(al2);
HashSet hs1 = new HashSet (al1); //removes duplicates
ArrayList al3 = new ArrayList(hs1); // converting HashSet to ArrayList
System.out.println(al3);
}
}
Thank you Sir :)
Thanks for sharing your knowledge. I have couple of questions.
1. String class thread safe or not?
2. Please explain ENUM with good example
String class methods not synchronized and for this reason String is not thread-safe. For enum, refer my site jdk 1.5 features.
sir please also write about nested class
Refer link:
http://way2java.com/java-lang/inner-classes/
sir plz ,tell me the servlet life cycle?
It cannot be spelled out in a few words. Read when I put servlets in the blog.
Dear Sir,
I am confused with Action class in MVC architecture of Struts. Please tell me whether it(Action class) is the part of Model or Controller?
Action class is part of model. It is the component where you write the business logic which generally includes database hits.
Sir when will you start the adv.java devoleping in this site……..if possible plz mention the date
sir plz tell my servlet has not any main method in it than how does it work by jvm?
Applet also does not have main(). JVM internally looks after it.
THANK YOU SIR THIS IS VERY MUCH HELPFUL TO ME……
Advice your friends also.
please sir explain this program
what will be the output of this program
thnx..
class A {
int ivar = 7;
void m1() {
System.out.print(“A’s m1, “);
}
void m2() {
System.out.print(“A’s m2, “);
}
void m3() {
System.out.print(“A’s m3, “);
}
}
c
l
ass B extends A {
void m1() {
System.out.print(“B’s m1, “);
}
}
c
l
ass C extends B {
void m3() {
System.out.print(“C’s m3, “+(ivar + 6));
}
}
p
ublic class Mixed2 {
public static void main(String [] args) {
A a = new A();
B b = new B();
C c = new C();
A a2 = new C();
a2.m1();
a2.m2();
a2.m3();
}
}
You must know method overriding rules when a subclass object is assigned to super class object.
1. When a subclass object is assigned to super class object, the super class object will call subclass method.
2. If the subclass method does not exist, the super class object will call its own method.
Apply these two rules you will get correct idea of the code.
A a2 = new C();
Here anonymous object of C is assigned to super class object A. To get confused, the code put one more class in between A and C. In a2 reference of C is there.
a2.m1();
As m1 does not exist in C, C calls its super class m1(). As B contains one, it call B’s m1() method.
a2.m2()
C does not have m2(). It looks for B class. It also does not have one. So, the control goes to A. As A have one, it calls A’s m2.
a2.m3();
As C has m3(), the A reference calls C’s m3();
If you understand well, the same program can be converted still more confused one.
Now apply the rules.
Hello sir,
I want some info on OPERATOR OVERLOADING? Does java support OPERATOR OVERLOADING?
Sir,
I am developing hotel site using Struts2 framework and Hibernate.
Please prefer to which JAVA CMS is used develop this project.How to integrate my Project with this CMS.
Java does not support operator overloading. Programmer is not allowed.
Go for MyEclipse 8.5 that gives you the libraries of Hibernate and Spring implicitly. I use it.
hi sir,
what is the maximum length can session id hold ?
Session ID is a system generated number consisting of letters (both uppercase and lowercase and digits. We can’t say the size exactly.
sir, u have given a program how to send an image to client but here i want to include “text/html” files also i mean including
image i want to display some other data(eg:- pw.println()) on the same browser
sir kindly give reply “urgently”.
1)can we give a print option from a servlet page.
2)after generating a servlet page can we edit it.
if possible or not possible how to get the desired output?
As Java program, you can give it; but where you want to print. Servlet is meant to send output to the client’s browser.
A tool like Eclipse, may generate a servlet file to you, but you can edit it.
sir, here i want a print out of servlet page(hard copy) after it is generated.
Vector v=new Vector();
try
{
Class.forName(“oracle.jdbc.driver.OracleDriver”);
Connection con=DriverManager.getConnection(“jdbc:oracle:thin:@localhost:1521:xe”,”system”,”manager”);
Statement stmt=con.createStatement();
ResultSet rs =stmt.executeQuery(“select * from employee_details where employee_id=”+id);
while(rs.next())
{
v.add(rs.getInt(1));
v.add(rs.getString(2));
v.add(rs.getString(3));
v.add(rs.getString(4));
v.add(rs.getString(5));
v.add(rs.getString(6));
v.add(rs.getString(7));
v.add(rs.getString(8));
v.add(rs.getString(9));
v.add(rs.getString(10));
v.add(rs.getString(11));
v.add(rs.getInt(12));
v.add(rs.getString(13));
v.add(rs.getInt(14));
v.add(rs.getString(15));
}
rs.close();
stmt.close();
con.close();
}
catch(Exception e)
{
out.println(“Exception is ;”+e);
}
request.setAttribute(“data”,v);
//Disptching request
RequestDispatcher dispatcher = request.getRequestDispatcher(page);
if (dispatcher != null){
dispatcher.forward(request, response);
}
Sir i retrieved all data from database into VECTOR and send it to JSP page….i am nt getting output while displaying on JSP…
Here is the JSP code…….
Vector data= (Vector)request.getAttribute(“data”);
itr=data.iterator();
..while( itr.hasNext() )
{
emp_id=(Integer)itr.next();
emp_name=(String)itr.next();
. ………………….
…………………
…………………..
……………………
}
As i need to display it into table i need to give specific values at perticular table fields so i need to stor tht in those emp id,name etc….if i use itr.next() it ll retrieve in sequence order bt i need to give to tables in diff positions ….. sir waiting for your reply plz solve my problem………….
If it is web application, you do it in JSP. If Swing, values can be put in JTable.
Dear Sir
Please find the attached program where i have tried to bring all the concepts of core java except applet,swing.
please give your comments and suggestions.
Thanks
David
Java studying student from chennai
import java.lang.String;
import java.lang.*;
import java.util.*;
import java.io.*;
class Trial
{
public void show()
{
String A=”David”;
String B=”Prabhu”;
int C=10;
int D=20;
int N;
int O=40;
double E = 10.5;
double F = 20.5;
float G=10f;
float H=10f;
final long I = 24L*60L*60L*1000L*1000L;
final long J = 24L*60L*60L*1000L;
}
}
interface Trialdemo
{
public void disp();
}
interface Trial1demo
{
public void print();
public void sit();
}
class Trial2demo implements Trial1demo
{
public void print()
{
System.out.println(“Static method”);
System.out.println(“Static method1”);
}
public void sit()
{
System.out.println(“Static Method Trial”);
System.out.println(“Static Method Trial1″);
}
}
class Trial1 extends Trial
{
public void show()
{
String A=”David”;
String B=”Prabhu”;
System.out.println(“Java Programme by”+A);
}
}
class Trial2 extends Trial
{
public void show()
{
int C=10;
int D=20;
int N;
int O=40;
double E = 10.5;
double F = 20.5;
float G=10f;
float H=10f;
final long I = 24L*60L*60L*1000L*1000L;
final long J = 24L*60L*60L*1000L;
System.out.println(“Adding”);
System.out.println(” C + D = ” + (C + D));
System.out.println(“Subtracting”);
System.out.println(” E – F = ” + (E – F));
System.out.println(“Multiplying”);
System.out.println(” C * G = ” + (C * G));
System.out.println(“Dividing”);
System.out.println(” I / J = ” + (I / J));
}
}
class Trial3 extends Trial
{
public void dast()
{
int C=10;
int D=20;
int N;
int O=40;
System.out.println(“conditional”);
System.out.println(“if else”);
try
{
if(D>C)
{
System.out.println(“D is Greater”);
throw new Exception(“confused”);
}
else if(O>D)
{
System.out.println(“O is Greater”);
}
else
{
System.out.println(“D is Greater”);
}
}
catch (Exception e)
{
System.out.println(“only throw,try,catch”);
}
}
}
class Trial4 extends Trial
{
public void show()
{
int C=10;
int D=20;
int N;
int O=40;
System.out.println(“While”);
do
{
System.out.println(“B is Even Number”);
}
while(C%2==1);
}
}
class Trial5 extends Trial
{
public void show()
{
int C=10;
int D=20;
switch (C=10)
{
case 10:
System.out.println(“Another Try”);
break;
default:
System.out.println(“Invalid Entry!”);
}
}
}
class Trial6 implements Trialdemo
{
int K[][]=new int[3][3];
public void disp()
{
K[0][0]=1;
K[0][1]=1;
K[0][2]=1;
K[1][0]=1;
K[1][1]=1;
K[1][2]=1;
K[2][0]=1;
K[2][1]=1;
K[2][2]=1;
}
public void stsi()
{
System.out.print(“Matrix is”);
for(int L=0;L<3;L++)
{
for(int M=0;M<3;M++)
{
System.out.print(K[L][M]+"/t");
}
System.out.println("/n");
}
}
}
class Trial7 extends Trial
{
public void show()
{
int B1 = 1 & 1;
int C1 = 1 ^ 0;
int D1 = 0 | 0;
float E1 = 0;
int F1=0;
F1=C1>> 2));
System.out.println(” left shift” +( 9 <> 2 right shift= ” +( 24 >> 2));
System.out.println(“Operator Precedence” + E1);
System.out.println(” Ternary ” +F1);
}
}
class Trial9 extends Trial
{
public void show()
{
int O=40;
System.out.println(“private” +O);
}
}
class Trial11 extends Trial
{
final int H1=12;
public void show()
{
System.out.println(“final keyword”+H1);
}
}
class Trial12 extends Trial
{
public void show()
{
try
{
int C=10;
int I1=C/0;
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
System.out.println(“confused”);
}
}
}
class Trial13 extends Trial
{
public void show()
{
System.out.println(“confused”);
System.out.println(“confused”);
}
public void dive()
{
System.out.println(“Starting String”);
}
}
class Trial14 extends Trial
{
char[]J1=new char[3];
String A=”David”;
String B=”Prabhu”;
int i=10;
public void show()
{
System.out.println(+A.length());
System.out.println(A.replace(“i”,”oo”));
System.out.println(A.toUpperCase());
System.out.println(A.toLowerCase());
System.out.println(A.concat(“B”));
System.out.println(A+B);
System.out.println(A.charAt(2));
System.out.println(A.compareTo(“Dav”));
System.out.println(A.contentEquals(“Dav”));
System.out.println(A.endsWith(“d”));
System.out.println(A.startsWith(“D”));
System.out.println(A.isEmpty());
System.out.println(A.equals (B));
System.out.println(A.toString ());
System.out.println(A.getBytes ());
System.out.println(A.intern());
System.out.println(+A.hashCode());
for(String K1:A.split(“a”,0))
{
System.out.println(K1);
}
System.out.println(+A.indexOf(“i”,2));
System.out.println(+A.lastIndexOf(“i”,2));
System.out.println(A.regionMatches(1,B,2,2));
System.out.println(A.regionMatches(true,1,B,2,2));
System.out.println(A.replaceAll(“D”,”T”));
System.out.println(A.substring(1,3));
System.out.println(A.valueOf(i));
System.out.println(A.toCharArray());
System.out.println(A.toString());
System.out.println(A.equalsIgnoreCase(B));
}
}
class Trial15 extends Trial
{
public void show()
{
String A=”David”;
String B=”Prabhu”;
StringBuffer L1=new StringBuffer();
L1.append(A);
System.out.println(” “+L1);
L1.insert(0,A);
System.out.println(” “+L1);
L1.length();
System.out.println(” “+L1);
L1.capacity ();
System.out.println(” “+L1);
L1.delete(0,3);
System.out.println(” “+L1);
L1.setLength(2);
System.out.println(” “+L1);
L1.reverse().toString();
System.out.println(” “+L1);
}
}
class tdemo extends Trial implements Runnable
{
public void run()
{
int g11=123;
int f11=456;
String a11=”david”;
try
{
System.out.println(“Student name=”+a11);
Thread.sleep(1000);
System.out.println(” “+f11);
Thread.sleep(1000);
System.out.println(” “+g11);
Thread.sleep(1000);
System.out.println(“java”);
synchronized(this)
{
for(int k11=1;k11<2;k11++)
{
k11++;
k11–;
System.out.println(k11);
}
}
}
catch(Exception e)
{
System.out.println(" "+e);
}
}
}
class finaltrial extends Trial
{
public static void main(String args[])
{
ThreadGroup tg=new ThreadGroup("Threading Group");
System.out.println(" "+tg.getName());
System.out.println(" "+tg.getParent());
tdemo z11= new tdemo();
tdemo y11= new tdemo();
tdemo w11= new tdemo();
tdemo v11= new tdemo();
tdemo U11= new tdemo();
tdemo T11= new tdemo();
Thread t11=new Thread(z11);
System.out.println("t is daemon by default: " + t11.isDaemon());
t11.setDaemon(true);
System.out.println("After making daemon, t is daemon: " + t11.isDaemon()); System.out.println("t is alive: " + t11.isAlive());
System.out.println("t is interrupted: " + t11.isInterrupted());
Thread t111=new Thread(y11);
for(int k11=1;k11<4;k11++)
{
k11++;
k11–;
System.out.println(k11);
}
Thread t211=new Thread(w11);
Thread t311=new Thread(tg,"New Threading Group");
System.out.println(" "+t311.getName());
System.out.println(" "+t311.getThreadGroup());
Thread t411=new Thread(v11);
Thread t511=new Thread(U11);
Thread t611=new Thread(T11);
t11.start();
t111.start();
t211.start();
t311.start();
t411.start();
t511.start();
t611.start();
t511.setPriority(Thread.MAX_PRIORITY-1);
t611.setPriority(Thread.MIN_PRIORITY+1);
t511.setName("High");
t611.setName("less");
try
{
System.out.println("java lang pack");
Thread.sleep(1000);
z11.wait();
System.out.println("java lang 2");
Thread.sleep(1000);
z11.notify();
System.out.println("java lang pack 2");
}
catch(Exception e)
{
System.out.println(" "+e);
}
Trial2demo Z=new Trial2demo();
Z.print();
Z.sit();
Trial1 Y=new Trial1();
Y. show();
Trial2 X=new Trial2();
X. show();
Trial3 W=new Trial3();
W. dast();
W. show();
Trial4 V=new Trial4();
V. show();
Trial5 U=new Trial5();
U. show();
Trial6 T=new Trial6();
T.stsi();
Trial7 S=new Trial7();
S.show();
Trial9 Q=new Trial9();
Q.show();
Trial11 Y1=new Trial11();
Y1.show();
Trial12 X1=new Trial12();
X1.show();
Trial13 W1=new Trial13();
Trial V1=new Trial();
V1.show();
Trial14 U1=new Trial14();
U1.show();
Trial15 T1=new Trial15();
T1.show();
String A8="David";
String B8="Prabhu";
String Z8="123";
int C8=10;
int D8=20;
int N8=50;
int O8=40;
double E8 = 10.5;
double F8 = 20.5;
float G8=10f;
float H8=10f;
final long I8 = 24L*60L*60L*1000L*1000L;
final long J8 = 24L*60L*60L*1000L;
char[]J1=new char[3];
System.out.println(" ");
System.out.println("Lang Package ");
System.out.println(" ");
System.out.println("Starting Math Class");
System.out.println(" ");
System.out.println(Math.min(C8,D8));
System.out.println(Math.max(E8,F8));
System.out.println(Math.max(I8,J8));
System.out.println(Math.sqrt(F8));
System.out.println(Math.pow(G8,H8));
System.out.println(Math.sin(F8));
System.out.println(Math.cos(I8));
System.out.println(Math.tan(H8));
System.out.println(Math.abs(E8));
System.out.println(Math.acos(E8));
System.out.println(Math.exp(E8));
System.out.println(Math.ceil(E8));
System.out.println(Math.floor(E8));
System.out.println(Math.log(E8));
System.out.println(Math.rint(E8));
System.out.println(Math.round(E8));
System.out.println(Math.random());
System.out.println(" ");
System.out.println("Starting String class");
System.out.println(" ");
System.out.println(+A8.length());
System.out.println(A8.replace("i","oo"));
System.out.println(A8.toUpperCase());
System.out.println(A8.toLowerCase());
System.out.println(A8.concat("B8"));
System.out.println(A8+B8);
System.out.println(A8.charAt(2));
System.out.println(A8.compareTo("Dav"));
System.out.println(A8.contentEquals("Dav"));
System.out.println(A8.endsWith("d"));
System.out.println(A8.startsWith("D"));
System.out.println(A8.isEmpty());
System.out.println(A8.equals (B8));
System.out.println(A8.toString ());
System.out.println(A8.getBytes ());
System.out.println(A8.intern());
System.out.println(+A8.hashCode());
for(String K18:A8.split("a",0))
{
System.out.println(K18);
}
System.out.println(+A8.indexOf("i",2));
System.out.println(+A8.lastIndexOf("i",2));
System.out.println(A8.regionMatches(1,B8,2,2));
System.out.println(A8.regionMatches(true,1,B8,2,2));
System.out.println(A8.replaceAll("D","T"));
System.out.println(A8.substring(1,3));
System.out.println(A8.valueOf(D8));
System.out.println(A8.toCharArray());
System.out.println(A8.toString());
System.out.println(A8.equalsIgnoreCase(B8));
System.out.println(" ");
System.out.println("Starting String Buffer class");
System.out.println(" ");
StringBuffer L18=new StringBuffer();
L18.append(A8);
System.out.println(L18);
L18.insert(0,A8);
System.out.println(L18);
L18.length();
System.out.println(L18);
L18.capacity ();
System.out.println(L18);
L18.delete(0,3);
System.out.println(L18);
L18.setLength(2);
System.out.println(L18);
L18.reverse().toString();
System.out.println(L18);
System.out.println(" ");
System.out.println("Starting Object class");
System.out.println(" ");
System.out.println(L18.getClass());
System.out.println(" ");
System.out.println("Starting Wrapper class");
System.out.println(" ");
System.out.println(Integer.toBinaryString(4));
System.out.println(Integer.toHexString(16));
Integer i8 = new Integer(C8);
String s8 = i8.toString();
System.out.println(s8);
int j=Integer.parseInt(Z8);
System.out.println(Z8);
System.out.println(" ");
System.out.println("Utility Package ");
System.out.println(" ");
System.out.println("Starting Class Date");
System.out.println(" ");
Date o8 = new Date();
System.out.println(o8);
System.out.println(o8.getHours());
System.out.println(o8.getMinutes());
System.out.println(o8.getSeconds());
System.out.println("month count starts from Zero =" +o8.getMonth() );
System.out.println("date count starts from One =" +o8.getDate() );
System.out.println("day count starts from Zero =" +o8.getDay() );
System.out.println("Year after 2000 is represented as 1year that is 2010 is represented as 110 =" +o8.getYear() );
System.out.println("This time count starts from 1.1.1900 =" +o8.getTime() );
System.out.println(" ");
System.out.println("Starting Class Calender");
System.out.println(" ");
Calendar p8 = Calendar.getInstance();
System.out.println("Calendar class cannot be instantiated. Its object can be obtained from its static method getInstance()");
System.out.println(" ");
Calendar q8 = Calendar.getInstance();
q8.set(2012, Calendar.MARCH, 20);
System.out.println(p8.get(Calendar.YEAR));
System.out.println(p8.get(Calendar.HOUR));
System.out.println(p8.get(Calendar.MINUTE ));
System.out.println(p8.get(Calendar.DAY_OF_MONTH));
System.out.println(" ");
System.out.println("Date Comparision ");
System.out.println(" ");
if(p8.before(q8))
System.out.println("Yes, before");
else if(p8.after(q8))
System.out.println("Yes, after");
else if(p8.equals(q8))
System.out.println("Yes, equals");
System.out.println(" ");
System.out.println(p8.get(Calendar.ZONE_OFFSET ));
System.out.println(" ");
System.out.println("what is zone offset? ");
System.out.println(" ");
System.out.println(p8.get(Calendar.WEEK_OF_YEAR ));
System.out.println(p8.get(Calendar.WEEK_OF_MONTH ));
System.out.println(p8.get(Calendar.DAY_OF_WEEK ));
System.out.println(p8.get(Calendar.DAY_OF_YEAR));
System.out.println(" ");
System.out.println("Starting class GregorianCalendar");
System.out.println(" ");
GregorianCalendar GC8 = new GregorianCalendar( );
System.out.println(GC8.get(Calendar.YEAR));
System.out.println("Era info: " + GC8.get(Calendar.ERA));
System.out.println("Hour info: " + GC8.get(Calendar.HOUR));
System.out.println("Minute info: " + GC8.get(Calendar.MINUTE));
System.out.println("Second info: " + GC8.get(Calendar.SECOND));
System.out.println("Millisecond info: " + GC8.get(Calendar.MILLISECOND));
System.out.println("Month info: " + GC8.get(Calendar.MONTH));
System.out.println("Week info of month: " + GC8.get( Calendar.WEEK_OF_MONTH));
System.out.println("Week in the year: " + GC8.get(Calendar.WEEK_OF_YEAR));
System.out.println("Date info: " + GC8.get(Calendar.DATE));
System.out.println("Day of month info: " + GC8.get(Calendar.DAY_OF_MONTH));
System.out.println("Day of year info: " + GC8.get(Calendar.DAY_OF_YEAR));
System.out.println("Day of week info: " + GC8.get(Calendar.DAY_OF_WEEK));
System.out.println("Day of week in the month: " + GC8.get(Calendar.DAY_OF_WEEK_IN_MONTH));
System.out.println("AM or PM info: " + GC8.get(Calendar.AM_PM));
System.out.println("Hour of the day info: " + GC8.get(Calendar.HOUR_OF_DAY));
System.out.println(" ");
System.out.println("Starting String Tokenizer");
System.out.println(" ");
String w8 = "David is";
StringTokenizer t8 = new StringTokenizer(w8);
System.out.println("Number of tokens " + t8.countTokens());
System.out.println(" ");
System.out.println("Starting String Tokenizer");
System.out.println(" ");
while(t8.hasMoreTokens())
{
System.out.println(t8.nextToken());
}
String r8 = "Awake@arise*stop/notmuntil@goal*reach";
StringTokenizer u8 = new StringTokenizer(r8, "@,m,*,/");
System.out.println("Number of tokens " + u8.countTokens());
while(u8.hasMoreTokens())
{
System.out.println(u8.nextToken());
}
System.out.println(" ");
System.out.println(" ");
System.out.println("Starting System Class");
System.out.println(" ");
System.out.println(System.getProperties ());
System.out.println(" ");
System.out.println("get Properties need both lang and util package to be imported since it involves date also");
System.out.println(" ");
System.gc( );
File f;
f=new File("David.txt");
try
{
if(!f.exists())
{
f.createNewFile();
System.out.println("New file \"David.txt\" has been created to the current directory");
}
else
System.out.println("The specified file is already exist");
}
catch (Exception e3)
{
System.out.println("Error: " + e3.getMessage());
}
try
{
FileInputStream fis = new FileInputStream("David.txt");
DataInputStream Din = new DataInputStream(fis);
InputStreamReader Isr=new InputStreamReader(Din);
BufferedReader br1 = new BufferedReader(Isr);
String strLine;
while ((strLine = br1.readLine()) != null)
{
System.out.println (strLine);
FileOutputStream fos = new FileOutputStream("Prabhu.txt");
DataOutputStream dos = new DataOutputStream(fos);
OutputStreamWriter Osr=new OutputStreamWriter(dos);
BufferedWriter br2 = new BufferedWriter(Osr);
br2.write("yes");
br2.newLine();
br2.write("No");
br2.flush();
br2.close();
}
}
catch (Exception e)
{
System.err.println("Error: " + e.getMessage());
}
System.out.println("The absolute path of the file is: " +f.getAbsolutePath());
File f1;
f1=new File("Prabhu.txt");
try
{
if(!f1.exists())
{
f1.createNewFile();
System.out.println("New file \"Prabhu.txt\" has been created to the current directory");
}
else
System.out.println("The specified file is already exist");
}
catch (Exception e2)
{
System.out.println("Error: " + e2.getMessage());
}
System.out.println("The absolute path of the file is: " +f1.getAbsolutePath());
}
}
Pl do not send big programs either to debug or to study. I appreciate your endeavor and time you have spent.
Hi sir,
what is the use of the POJO classes , we cant write any thing with out pojo classes ?
POJO is simply a Java object. We use this word in frameworks like Hibernate etc.
Hi sir,
What are helper classes used in core java, and what is the use of those classes
If we want an object of a class very often in day-to-day programming, instead of writing a lengthy code, we write all the code in a method and return the object. These are known as helper methods or helper classes (some people, in a different mood, also call as factory classes and factory methods).
examples of standard alone applications which are by java….
Standalone means that can execute at DOS prompt, without the help of a third party tool like browser.
Is it possible to access data from super-package to sub-package?
Suppose p1 is a package & the classes are available in p1.* and another sub-package p2 to p1 such that the classes of p2 are available in p1.p2.* . If I want to access the data of p1 package in p2 package so what is the real code I need to write?
Please explain briefly…
import both packages like you do java.awt.*; and java.awt.event.*;
Sir,
On 6th April we are having interview with NBOS Technologies .
Regards,
Orafact student.
Congrats.
Hi sir,
can you please explain what is marker interface with example and what is the difference between normal interface and marker interface
Refer this link:
http://way2java.com/java-lang/cloning-%e2%80%93-duplicating-an-object-marker-interface/
S N Rao
Hi sir,
Can you please list out the major differences between list and set
Set stores unique elements where as list does not. List can use ListIterator but not Set. Subclass TreeSet displays the elements in natural (ascending) order. Refer my way2java thoroughly.
sir,how to retrive image to servlet page(on browser) including “text/html” files.
import javax.servlet.http.HttpServlet; import avax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException; import java.io.OutputStream;
import java.io.IOException; import java.io.FileInputStream;
import java.io.DataInputStream; import java.io.File;
public class SendImage extends HttpServlet
{
public void service (HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
{
res.setContentType(“image/gif”);
OutputStream ostream = res.getOutputStream( ); // for binary stream
File f = new File(“c:\\bird3.gif”);
DataInputStream dis = new DataInputStream(new FileInputStream( f ));
byte[] barray = new byte[(int) f.length( )];
try { dis.readFully(barray); }
catch (Exception e) { barray = null; }
finally { dis.close( ); }
ostream.write(barray);
ostream.close( );
}
}
sir, here i want to include “text/html” files also i mean including
image i want to display some other data(eg:- pw.println()) on the same browser
sir kindly give reply “urgently”.
Hi sir,
String s1=”abc”;
String s2=”ab”+”c”;
if(s1==s2)
what will be the out put sir can u please explain the internal logic of this
JVM maintains a pool of string objects. s1 and s2 refer the same string object (whose value is abc) in the pool. Logical equals to return true if both objects refer the same value.
Hi sir,
How to make a class immutable, i thought it can make by using final key word but in a interview it was said
as wrong ,
if it is wrong can you please tell me how to make a class as immutable
To make a class immutable,
1. Don’t provide any methods that modify the object.
2. Ensure that no methods may be overridden. Mark the class
as final. Make all fields final and private.
Sir
what is the use of DeflaterOutputStream & InflaterInputStream in java.util package???
You can zip and unzip without using jar command.
sir,
Can u please explain me what exactly the Encapsulation is and how it is worked with a simple example .
public class Employee
{
in salary;
public static void main(String args[])
{
Employee emp1 = new Employee();
emp1.salary = 5000;
System.out.println(emp1.salary);
}
}
We say, emp1 is encapsulated with salary. Means, both becomes one unit so that other cannot read or modify or delete.
sir,i want to ask one question from adv.java(servlets) what is the diff between sendRedirect()
and requestDispatcher() methods
Programmer uses sendRedirect(String file) to send a file to the client. With this method, control is returned to the client.
getRequestDispatcher(String otherServlet) returns an object of RequestDispatcher. This method is used to connect to the other servlet. Control is within the server only.
sir, can we pass conroll from one servlet to another servlet with sendRedirect() .
If yes why requestDispatcher() again.
You can’t pass. sendRedirect() is meant to send user a file.
can we connect servlet to jsp page using sendRedirect() if no, how we connect?
sendRedirect() is used to send a file to client. If you send a JSP file, the client should have web server like Tomcat.
Hello sir
i want program for for this scenario
need to have one main server which communicates with 3 sub servers and client should communicate with main server and need main server should get the data from 3 servers and need to return response to client program
Once you understand the TCP/IP and UDP protocols and the programs from way2java.com, you must develop this kind of programs by yourselves. It will be a very good practice as the task is very good. I will not find time to write such big code. Sorry.
But here the problem is how to communicate between the two servers that i am not able to understand
Hello Sir,
What is the use of String intern() method and what is the difference between String s1=”hello” ,
String s2=new String(“Hello”) and String intern methods
Refer these links:
http://way2java.com/string-and-stringbuffer/region-matches-interning-splitting/
http://way2java.com/string-and-stringbuffer/introduction-immutable-nature-comparison/
Hello Sir,
How to Print ArrayList Values in Formated Way Just Like
1 Bharani 20000 Malakpet Hyderabad
2 Sravan 30000 Malakpet Hyderabad
See this code:
ArrayList al = new ArrayList();
al.add(1); al.add(“Bharani”); al.add(20000); al.add(“Malakpet”); al.add(“Hyderabad”);
al.add(2); al.add(“Sravan”); al.add(30000); al.add(“Malakpet”); al.add(“Hyderabad”);
Iterator it = al.iterator();
int counter = 0;
while(it.hasNext())
{
System.out.print(it.next() + ” “);
if(counter++ ==4)
{
counter = 0;
System.out.println();
}
}
For the alignment of output, go for GUI (java.awt package)
Hi sir,
Can u please explain why counter has been again to 0 in loop
Or else, how you get to next line the second record.
what is the diff between getclass() and instanseof
I think you can understand by seeing the following code.
class Test { int x = 10; }
public class Demo
{
public static void main(String [] args) throws ClassNotFoundException
{
Class c = Class.forName(“Test”);
System.out.println(c.getClass());
System.out.println(c.getName());
Test t1 = new Test();
if(t1 instanceof Test)
{
System.out.println(t1.x);
}
}
}
thanq sir…..
sir iam unable to remove Ds elements with iterator method i.e it.remove() when i added
non homogeneous objects like double ,int, String to Ds . Then how to remove Ds elements with iterater
in case of diff. objects.
No, it removes. See this code:
import java.util.*;
public class Demo
{
public static void main(String [] args)
{
LinkedList list = new LinkedList();
list.add(10);
list.add(10.5);
list.add(“hello”);
System.out.println(“Before removal: ” + list);
Iterator it = list.iterator();
while(it.hasNext())
{
it.next();
it.remove();
}
System.out.println(“After removal: ” + list);
}
}
Ofcourse sir,here iwant to remove perticular element. for eg-“hello”
See this while loop:
while(it.hasNext())
{
Object obj = it.next();
if(obj instanceof String)
{
it.remove();
}
}
thanq sir i am happy with ur answer…………
sir, what is autoboxing and autounboxing?
Boxing and unboxing put together is known as auto boxing, a feature imparted to DS from JDK 1.5. Converting primitive data type (like int) into object (like Integer) is known as boxing and again converting back the object(Integer) into data type (int) is known as unboxing. For more information refer:
http://way2java.com/java-versions-2/jdk-1-5-java-se-5-version/
and
http://way2java.com/collections/data-structures-jdk-1-5-features/
why “extends” between interfaces ? why not “implements”?
You know “super class method is a subclass method” and this is known as “is-a” relationship. Extends gets super class (here, it is interface) abstract methods in another interface which is accepted. For the same reason, we cannot extend a concrete class to an interface.
thanq sir i got it……….
what is “ConcurrentmodificationException” and when it is occured.
See this link:
http://way2java.com/exceptions/concurrentmodificationexception/
sir, plz tell us about wrapper class with example .
See this link:
http://way2java.com/java-lang/wrapper-classes/
Vector v=new Vector();
//here i have added some elements
Enumeration e=v.elements();
while(e.hasMoreElements())
{
sop(e.nextelement());
}
in the above code we know Enumeration is an interface which is not provided impl for thier methods.
But when we call e.hasMoreElements() and e.nextElement() how they return boolean value and
Object respectually .here i mean where the implementation provided for those methods (even Vector class
also not consist those methods )
There will be a subclass which will implement the methods.
then what is the use here by declaring Enumeration as interface why we cnt provide impln there.
We know elements() method of Vector returns an object of Enumeration interface. If Enumeration is not an interface if implementation exists, they you will create object of it and try to override it, which of course much not useful to you. For this reason, Enumeration is declared as interface. If you require further information, it you are at Hyderabad, meet me personally.
thank u sir i understood that…………
sir,
i have very excited while going trough this site to learn java becoz i have never seen this type of persistent notes in any other sites.
thanx for giving this.is WAY2JAVA books available in the market?
Nice. Advice your friends also. Why you need a book when the site is free?
sir,
plz tell me in brief about clone() and Cloneable interface with suitable examples.
See this link:
http://way2java.com/java-lang/cloning-%e2%80%93-duplicating-an-object-marker-interface/
S N Rao
Sir,
How to compare two strings without using API?
public class Demo
{
public static void main(String [] args)
{
String str1 = “hello”;
String str2 = “world”;
String str3 = “hello”;
if(str1 == str2)
System.out.println(“str1 and str2 are same”);
else
System.out.println(“str1 and str2 are not same”);
if(str1 == str3)
System.out.println(“str1 and str3 are same”);
else
System.out.println(“str1 and str3 are not same”);
}
}
Above type of logical equal to comparison fails in the following case.
String str1 = new String(“hello”);
String str2 = new String(“hello”);
sir i want program for below concept: awt
create 10 buttons using arrays if i press first button 1 has been displayed in textField same for upto ten buttons ple help me
// create 10 buttons using arrays if i press first button 1 has been displayed in textField same for upto ten buttons.
import java.awt.*;
import java.awt.event.*;
public class Display extends Frame implements ActionListener
{
TextField tf;
public Display()
{
setLayout(new FlowLayout());
Button btn[] = new Button[10];
for(int i = 0; i < btn.length; i++) { btn[i] = new Button(""+(i+1)); btn[i].addActionListener(this); add(btn[i]); } add(tf = new TextField(10)); setSize(300, 300); setVisible(true); } public void actionPerformed(ActionEvent e) { tf.setText(e.getActionCommand()); } public static void main(String args[]) { new Display(); } }
Hai sir,
I am very new to programming languages but I know some concepts in C. So I want to learn Android apps development. My question is to learn apps development it is necessary to learn Java technologies or I can go directly to apps development tutorials. Please sir, give me your advise so I can make decision. Thanks in advance.
For Android, it is a must to know Core Java (not all chapters).
Sir
I am getting provlem like this. Pls suggest me
C:\sara\Jdbc>javac Jdbc.java
C:\sara\Jdbc>java Jdbc
Exception in thread “main” java.sql.SQLException: Io exception: Connection refus
ed(DESCRIPTION=(TMP=)(VSNNUM=186647040)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=1250
5)(EMFI=4))))
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:323)
at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:260)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Jdbc.main(Jdbc.java:7)
There is a driver problem in your program. Contact me in the class.
Sir,
I have installed jdk 1.3 & 1.7 versions and set the classpath for both versions. It is using only jdk 1.7 version in commnad prompt. I need to use jdk1.3 in some times. How can i switch between two java versions in command prompt
set the path for jdk1.3 at the command prompt. It works as long as you do not close the prompt. It is a temporary path.
Sir pls tl other Desgin patterns
Now only one design pattern, Singleton, is put. Slowly I will place others also.
will u send ur book in my emailid
Sorry, it is not possible.
sir,what do u mean by primitive data types
Java has got primitive types and reference types. Primitive types are int, double etc. Reference types are objects.
Demo d1; // where Demo is a class
d1 = new Demo();
d1 is known as reference type.
Sir
What is the differenece b/w
System.exit(0); and System.exit(1);
Both are working same……
0 indicates normal shutdown. Other than zero indicates abnormal shutdown like terminating the OS with some problems or switching off the power supply directly. Abnormal can be noticed with scan disk (if you do not have a backup power supply (like UPS) and if the power goes abruptly)
i need materials for c and c++ sir… pls….
If you know me, contact me at Config; I got hard copies not soft copies.
sir,
I have learnt Core JAVA through the excellent site (way2java.com) . I want to learn now Advanced JAVA but i couldn’t find the link for that in this site ,, can you please send me the link through which i can learn the Advance JAVA too .
Thanks & Regards ,
khan.
Sir,
I Learnt Core JAVA from this site but i couldn’t find the advanced java in this site can u please send me a link through where i can learn the advance java .
Thanks& Regards .
Khan .
sir i have purchased ur book and its really good for beginers
dear sir can you tell me good book for servlet and jsp ??
Each technology is a ocean. Separate books are available in the market. One book will not do justice. Purchase, practice and then refer the web (with google search).
Sir,
you explained only about java.please explain about C,C++….
Even though I started my career with C/C++, I do not find time to write them as still I have to do with Advanced Java in way2java.com.
Not possible at this juncture. I am completely working for Java.
Sir could you please provide some knowledge on what is delegation and reflection?
Regarding reflection, it will be posted within two days in the home page.
Now you can see the home page on Java Reflection.
sir,
how to create own include functions in java
Question is not clear.
sir, what are the concepts we need to take into consideration if we want to create a simple client networking application?
Is it LAN or Web or Enterprise (like RMI).
sir,
how to convert date object into integer value ???
Sir can u give me an example of “this” keyword
See this link:
http://way2java.com/oops-concepts/using-this-keyword/
Sir can u help in sorting this program according to emp.deptid
/**
*
*/
//package com.sirocore.temp;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* @author Asim Hafeez
*/
pu