SAP Hybris suite , Hybris tutorial, Java, J2ee Stuff Online-

Recent questions tagged java

Hello Friends, Last saturday during interview of Hybris developer for company BORN group , i got question from core java where he asked that "How you reverse a int ... ; System.out.println("Reversed array is "); printArray(arr, 6); } }
Tips to write low latency applications in Java
Guys you can test try-catch-finally concept by giving answer of below scenario Following Below multiple scenario question related to try, catch and finally ... testMethod! Inside finally block of testMethod! Returned value of i = 100
As you know last day i have discuss question What and Why Marker Interface in java details: http://everyreply.com//742/what-marker-interface-java-why- ... and pass in your class like TreeSet ts= new TreeSet(new emplyeeIdComparator());
Dear Friend, In my every Hybris interview in starting i got some Hot Java question so today i will discuss with topic Marker Interface which below ... use reflection or similar mechanism to check the class has the desired @annotation.
How can you detect the Shutdown of a JVM programmatically? One possible way of doing it by adding a Shutdown Hook to the JVM (Is there any other way? ... which may cause the state of your application to become inconsistent in such a case.
Loading, Linking, & Initialization of Types in Java The Java Virtual Machine makes the Types (we'll discuss here the user defined Types - classes and ... may occur during any of the three phases - Loading, Linking, and Initialization.
Can we access an unreachable object in Java? Yeah... we can. Sounds strange? But, it's true. We can access an unreachable object in Java. This ... . We'll discuss about the weak references and about this approach in some other article.
How many ways of creating objects in Java? Well... there aren't many different ways I suppose. But from an application programmer perspective here are ... JNI and I sincerely welcome comments from the JNI experts if they think otherwise.
Write a Java program using RegEx to identify a String representing int/float (Whitespaces allowed) Some of you may think why to use Reg Ex to identify Strings ... point exists. I hope we all can now move to the complete code listing
Can we have two java.lang.Class instances of the same Type? Yeah... we can have any number of java.lang.Class instances of the same ... (as required by synchronization) hence it'll always be significantly faster than synchronization
Differences between Swing and AWT. When to use what? "Swing" was actually the code name used by Sun during the development and it was planned ... your application which is very hard to find at least for platform-independent applications.
Creating zip/jar files programmatically in Java Write a Java application which automatically zips the directories. The application should accept the input and output ... you're done! Just try out in case you find it interesting.
What is Recursion? It's a programming technique which facilitates writing simpler, shorter, and clearer code. A fucntion calling itself (either directly or indirectly) is called ... == 0) return 1; else return (n * factorial(n-1)); }
Oracle Database - How to tune for better performance? Why to tune? Simply to improve performace of the overall system by enabling the best possible resource ... to ensure the proper execution of the Oracle DB installed on the system.
Role of JDBC in Java JDBC is probably used to achieve the following three tasks in Java:- Connect to data source - it helps the Java program to ... is normally used only for development and testing purposes and not for production use.
JDBC APIs support both the architectures - 2-tier and 3-tier models for accessing a relational database. JDBC for a 2-tier architecture In such an ... Application Server as the Middle-tier, and a Relational DBMS as the Back-end.
Yes. IOException is the super class of FileNotFoundException. So, if you put the catch statement for IOException above that for FileNotFoundException, then the code for ... of a sub class can be easily accepted by a super class reference.
By using ‘this()’ syntax. Just specify the corresponding parameters to ‘this(…)’ to call the particular constructor.
While assigning an object of data type Superclass' to an object of the data type Subclass', explicit casting is required. If we do the reverse, then the ... class in Java, so it'll automatically be a superclas of CustomClass' as well.
transient' means the member variable can't be serialized with the object. Reason being, the value of such a variable is dependent upon other external factors ... variable will be assigned to its default value depending upon its data type.
Accessing Superclass Members: If a subclass has overridden certain method of a superclass then super' keyword is used to call the superclass method from within any method ... super(p); // it should be the first line // implementation } }
Synchronized block retains the lock for comparatively smaller period of time as compared to synchronized methods, at least in most of the cases. So, try to use synchronized blocks as long as it doesn’t affect the business requirement.
In Java, the class System' contains two properties named out' and err', which represent the standard output and the standard error device, respectively. ... can now be done as:- System.setOut(customOutput); System.setErr(customError);
It's a programming framework which allows Java code (running on a JVM) to call and be called by the native applications. Native applications mean the ... programmers only. Mainly the people involved in the development of Tools/IDE use JNI
public static void main(String [] args) - this is the signature of the main method in Java. public' access specifier means that the method can be ... the main method overloaded. You probably need to check your design before doing this.
You can't force it to run. You can only request. This request can be made by calling System.gc()' API. GC is never guaranteed by the JVM to be ... particular implementation of the JVM, it may prioritize the next cycle of GC. That's it.
In Java, all programs are compiled into bytecodes in form of .class files. These bytecodes can run on any platform. Bytecodes are special kind of representation for the ... compiled .class' file to the system you want to run the code on.
An empty interface having no methods or fields/constants is called a marker interface or a tag interface. This of course means if the interface is extending ... but marker interfaces can surely be a preferred choice for some in some cases.
Does 'static' cause Memory Leak in Java? What's memory leak? In simple terms, it's unused but referenced (somehow because the programmer probably ... to explicitly nullify objects once you finish using them (especially the large objects)
Below Points you should remember related to constructor in java during Interview 1. While creating new object for the class ,every constructor ... constructor 13. Constructors are never inherited, thus they cannot be overridden.
No you cant access non static variable in static context because static context are loaded in memory when the class is loaded where as non static variables are instance variables and are created only when object is created
Answer of this tricky question in Java is that finally block will execute even if you put return statement in try block or catch block but finally block won't run if you call System.exit form try or catch.
When we create string with new() Operator, it's created in heap and not added into string pool while String created using literal are created in String pool itself ... e.g. String s = "Test" Java automatically put that into String pool.
Immutable classes are Java classes whose objects can not be modified once created. Any modification in Immutable object result in new object. For example is ... member as non final but private and not modifying them except in constructor.
the java.util.Map class in JAXB (JSR-222)? In this post I will cover some items that will make it much easier. Customer.java package everyreply.dto; import java ... <street>1 A Street</street> </value> </entry> </addressMap> </customer>
Can you please explain how remove(key) method works internally on hash map?
A bucket is used to store key value pairs . A bucket can have multiple key -value pairs . In hash map, bucket used simple linked list to store objects ... stored in the link list(bucket) , whose header represents the value of the Hashcode.
have one doubt in String class String s1="abc"; String s2=new String("abc"); when we compare the both s1==s2; its return false and when we ... have dough whether s1 and s2 are storing hashcode are any thing else apart from hashCode
Singleton Pattern ensures a class has only one instance and provides a global point of access to it. The default constructor of the class is made ... this while creating objects of thread pools, caches etc to avoid wasting resources.
Yes , we can override init(ServletConfig config) into servlet , but when you retrive ServletCofig object into inside servlet give Nullpointer ... and enviornment information to particular servlet through init(ServletConfig config) .
Concept 1: can we write a method same name as constructor in class definition. Exp: Yes we can write a method same name as constructor in ... args) { constructorTest ct=new constructorTest(); } } Above code compile without Error
J2SE v1.3 has introduced a dynamic proxy class in the Java Reflection package. A dynamic proxy class implements a list of interfaces specified at runtime such ... called through an instance of a class that does not implement an interface.
Hello, I have face this question most of time in java interview question and my below answer can make you clear the difference 1. By Using comparable interface sorting logic(compareTo(Object obj ... .getName()); } } }
Servlet Context is used per Web apllication so we can't use more than one Context,Servlet Config is per servlet or per Jsp so you can use the more than one Config
Finally is the block of code that executes always. The code in finally block will execute even if an exception is occurred. Finally block is NOT called in ... block and not handled then remaining code in finally block may not be executed.
Why main() in java is declared as public static void main? What if the main method is declared as private?
How can we access the members of local Non static class in outer class in Java . Please guide me
Please help me........ I want to upload file in java servlet but i am unable to upload file.... it generates exception (internal server error...) My code is ... method used with " + getClass( ).getName( )+": POST method required."); } }

...