I am trying to use method overloading to find the area of a rectangle. Only thing is the values have to be entered by the user. But if it has to accepted from the user, shouldn't we know the datatype of his input? And if we do, then the purpose of overloading becomes useless, because I already know the datatype.
Can you guys help me out?
You can add onto this code:
import java.io.*;
import java.lang.*;
import java.util.*;
class mtdovrld
{
void rect(int a,int b)
{
int result = a*b;
System.out.println(result);
}
void rect(double a,double b)
{
double result = a*b;
System.out.println(result);
}
}
class rectarea
{
public static void main(String[] args)throws IOException
{
mtdovrld zo = new mtdovrld();
Scanner input= new Scanner(System.in);
System.out.println("Pleaser values:");
// Here is the problem, how can I accept values from user where I do not have to specify datatype and will still be accepted by method?
double a = input.nextDouble();
double b = input.nextDouble();
zo.rect(a,b);
}
}
As we get closer to October 2025 and the end of Windows 10 support, Windows 11 will pick up its pace and soon become the most popular desktop operating system worldwide.
That's an assertion. It's also quite possible that the only growth will come from attrition as people and companies buy new machines that only come with Win11. It's also possible that we'll get a literal repeat of Win XP and Win 7, where a large number of users just waited until Microsoft gave in and fixed the core problems that the consumers were complaining about in Win Vista and Win 8 when they released Win 7 and Win 10.
Microsoft and Crowdstrike announce partnership on threat actor naming by Pradeep Viswanathan
Whenever a cyberattack is discovered, companies disclose it to the public and assign it a unique name based on their internal procedures. Unfortunately, this leads to inconsistencies, as each company has its own naming conventions. As a result, the same threat actor behind a cyberattack may end up with multiple names, causing delays and confusion in response efforts.
For example, a threat actor that Microsoft refers to as Midnight Blizzard might be known as Cozy Bear, APT29, or UNC2452 by other security vendors.
To address this issue, Microsoft and CrowdStrike are teaming up. These companies will align their individual threat actor taxonomies to help security professionals respond to cyberattacks with greater clarity and confidence.
It’s important to note that Microsoft and CrowdStrike are not attempting to create a single naming standard. Instead, they are releasing a mapping that lists common threat actors tracked by both companies, matched according to their respective taxonomies. The mapping also includes corresponding aliases from each group’s naming system. You can view the joint threat actor mapping by Microsoft and CrowdStrike here.
Although this threat actor taxonomy mapping is a joint effort between Microsoft and CrowdStrike, Google/Mandiant and Palo Alto Networks' Unit 42 are expected to contribute to this initiative in the future.
Vasu Jakkal, Corporate Vice President of Microsoft Security, wrote the following about this collaboration with CrowdStrike:
As more organizations join this initiative, the collective defense against cyber threats will undoubtedly be improved.
Question
Unto Darkness
I have got a problem.
I am trying to use method overloading to find the area of a rectangle. Only thing is the values have to be entered by the user. But if it has to accepted from the user, shouldn't we know the datatype of his input? And if we do, then the purpose of overloading becomes useless, because I already know the datatype.
Can you guys help me out?
You can add onto this code:
Link to comment
https://www.neowin.net/forum/topic/722390-java-method-overloading-while-accepting-input-from-a-user/Share on other sites
5 answers to this question
Recommended Posts