Akshayyha Krishnamurthy

Greenhorn
+ Follow
since Aug 17, 2018
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Akshayyha Krishnamurthy

@Campbell Ritchie The question was written by me since I had the doubt. I have added some additional details as well to show how I got a query.
3 years ago


Output:
18

The above code snippet produces an output which I thought would throw an error. My understanding on the assignment operator was it will behave like val = val + x so val would also type cast to int and addition would be performed resulting in int value. So, when it tries to assign that to a short value it would throw an error.

Could anyone please explain how this works internally in java?
3 years ago
I am a beginner to Spring Boot so have started with Dependency Injection concept. One thing I see about DI in almost all the sites is that 'Lifecycle of the objects are maintained by Spring'. Even before Spring in core Java, I couldn't see it is maintained by us with the ClassLoaders and GC involved.

Could someone explain me how objects are maintained in java before Spring Boot DI came into play?
4 years ago
Every program in Java is converted to bytecode, which is platform independent. And Serializable is also used to convert the state of an object to a byte stream so that it can be distributed since it becomes platform independent. Why do we need to use Serializable when we already have a bytecode? Am confused with this  Could anyone explain me?
6 years ago
I have a table 'orders' having columns
id int, month_date date, orders int

id month_date orders
1 2018-02-03 250
2 2018-01-03 150
3 2018-10-08 150
4 2018-11-08 420
5 2018-04-03 578
6 2018-05-04 489
7 2018-08-07 420

I have to display the top 5 orders in descending order and if the orders are same then list the dates in descending order.

What I have tried:

select mont_date, no_of_orders
from orders
order by no_of_orders desc
limit 5;

But I don't know how to display the dates in descending order when the orders in top 5 are same. Please someone help me.

Structures and Unions are for grouping data members to create a new data type. Union uses a shared memory, unlike Structure.
Could anyone explain me the need to use Structures when a class is present  Thanks in advance
6 years ago
I came across these terms and I'm a bit confused about the differences.

While searching for explanations I found few more terms like "Hold and Wait", "No preemption", "critical section" which made me more confused   .

Could anyone explain me the differences among 'Mutual Exclusion', 'Critical Section', 'Synchronization', 'Hold and Wait' and 'No preemption'?

Thanks in advance  
Sorry, both JRE and JVM physically exists. What does it mean to physically exist?
I studied that, unlike JVM and JRE, JDK physically exists.
But we install the JDK only when we need to code in java.
So where does it or how does it physically exist?

Thanks in advance to those who clear my doubts
The overriding methods:
1. shouldn't be more restrictive than the overridden method
2. shouldn't have a new or broader exception(only for checked exceptions) than the overridden method
3. should have same or covariant return types.

I referred few materials to know the reason behind these, but still am confused. Could anyone explain me the reason for these three rules with small examples?    
Thanks in advance  
6 years ago
Hey people.. I've tried using <one-to-one> tag. it worked when used like this:

But didn't work when used as :

Because, <one-to-one> tag doesn't have column attribute
I tried other mappings too and I found these :
<one-to-one> doesn't have column attribute
<one-to-many> doesn't have both name and column attributes
<many-to-one> has both name and column attributes
<many-to-many> doesn't have name attribute

Could someone explain to me why its so?
6 years ago

In the above code we perform one-to-one mapping using <many-to-one> by setting unique="true". There is also a <one-to-one> tag. Could anyone explain me why <many-to-one> tag is used for one-to-one mapping even if <one-to-one> tag exists ?
I tried using <one-to-one> tag but there is no 'column' attribute in <one-to-one> tag
6 years ago
Actually, there are most tags in all the three of them like for text field in  HTML its <input type="text">, in struts its <s:textfield name="" label=""> so whats the difference between them ?
6 years ago
I have been studying these tags but am not clear with their uniqueness.
Could anyone explain me the differences among HTML , JSP and Struts tags ?
Thanks in advance    
6 years ago
I am new to Struts. I have installed all the struts2 plugins in Netbeans 8.1. The server that I'm using is Glassfish 4.1.1.  When I run the following code I get:

HTTP Status 500 - Internal Server Error
type Exception report

messageInternal Server Error

descriptionThe server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
root cause

The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1.1 logs.

GlassFish Server Open Source Edition 4.1.1


and I've used this line in my code:
<%@taglib uri="/struts-tags" prefix="s"%>

web.xml file

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
   <filter>
       <filter-name>struts2</filter-name>
       <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
   </filter>
   <filter-mapping>
       <filter-name>struts2</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>
   <session-config>
       <session-timeout>
           30
       </session-timeout>
   </session-config>
   <welcome-file-list>
       <welcome-file>index.html</welcome-file>
   </welcome-file-list>
</web-app>


I've referred more solutions indicating the missing jar files, but i have all of them but still the JasperException occurs. Could anyone provide a solution for this ?
Thanks in advance  
6 years ago