|
Be careful of integer arithmetic.
1/(anything except 1) will yield 0.
Use more intermediate variables with precise names to help you via debugger.
|
|
|
|
|
I am trying to find the path of resource using Paths like below and then copying some files at runtime. While at runtime it works perfectly fine. However while running locally for junit testing, it throws below error at the below first line while trying to get Path using URI. I am not using any zip/jar file so why I am getting the below stack trace. Am I missing something?
Path path= Paths.get(ABCD.class.resource("/").toURI());
String mockFileName="cacerts";
File mockFile= new File(path+File.seperator+mockfileName);
Error
java.nio.file.FileSystemNotFoundException
at com.sun.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:171)
at com.sun.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:157)
at java.nio.file.Paths.get(Unknown Source)
|
|
|
|
|
The message is clear, the path it is trying to access does not exist. You need to use the debugger to find out exactly what paths it is trying to find. That is the only way to discover what causes the problem.
|
|
|
|
|
saurabh jasmeen mehta wrote: Path path= Paths.get(ABCD.class.resource("/").toURI());
Presumably in your test code.
Modify your test code to collect that path first, as a string, then wrap that line in a try/catch and if the exception occurs throw an exception which includes that name.
saurabh jasmeen mehta wrote: ABCD.class.resource("/")
You might also want to just create some local code to test exactly what that means. I did that years ago and the way it does that is not simple.
|
|
|
|
|
Q1. Write a program using methods to find whether a point (x1,y1) lies on a circle of radius 2 cm and h = 5; the equation of circle is given by 〖(x-h)〗^2+〖(y-h)〗^2=r^2 . The method returns a Boolean value.
|
|
|
|
|
You have all the necessary information in the question, so you need to show us what you have written and where you are stuck. We are not going to write your assignment for you.
|
|
|
|
|
[httpGet]
public string ApplyGroupOperation (string values , string op)
{
string[]valueList = values.Split(Values , ',');
var result=0;
for (int i=0 ; i<valuelist.count ;="" i++)
switch(op)
{
case"+":
result+="int.parse(ValueList[i]);
break;
case"*":
result*=int.parse(ValueList[i]);
break;
default:
break;
}
}
return" result;
}
<pre="">
|
|
|
|
|
You forgot to ask a question.
|
|
|
|
|
There is somthing wrong in this code , i need to know it
|
|
|
|
|
Then you need to explain what it is and where it occurs. We cannot guess what you see on your screen.
|
|
|
|
|
I get the feeling this is a "find the bug(s)" assignment.
|
|
|
|
|
|
How to find the answer.
Review your notes for class.
Review reading material
Look at the code
Determine where the errors (plural) are
Write that down.
|
|
|
|
|
write a recursive function which takes 2 input parameters. The first is an employee id and the second is another employee id. We need this function to check if the second Employee is one of the direct or indirect managers, it must return true if the second employee is one of the reporting line for the first employee, otherwise it will return false
Employee
Emp Id int primary key,
Name varchar(50) not null,
Manager int references Employee (Emp_ld),
JobTitle int references JobTitle(JTId)
|
|
|
|
|
You first have to figure out who's "at the top"; then you can recurse down the "tree": That would be the "one" with NO "Manager" (everyone else MUST have one). If you have more than one without a manager, then you have a leadership problem.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
is this pseudo code ok ?
bool check (emp-id1 , emp-id2)
if {(emp-id2 == emp-id1.Manager)
return true;}
else if {(emp-id1.Manager == Null)
return false;}
else {
return (emp-id1.manager , emp-id2)}
|
|
|
|
|
I am new to Java but I have worked on the Microsoft product stack. Is there a "make" and/or "project" file equivalent in Java and is there such a project file that is only associated with whichever IDE I am using?
|
|
|
|
|
Which IDE are you using? Both Eclipse and Netbeans have their own build systems. If you are not using an IDE then you could write your own Makefiles, and use nmake or similar.
[edit]
You already asked this question at What is the equivalent project file for a java project?[^], and we still have no idea which IDE you are using. If you want help then please provide full details of the problem.
[/edit]
modified 13-Oct-22 4:14am.
|
|
|
|
|
Wap in java to display this pattern
I
C
S
E
|
|
|
|
|
OK, I have done that. Now what?
|
|
|
|
|
I don't know the solution
modified 24-Sep-22 16:11pm.
|
|
|
|
|
Is it your homework?
Do you know how to solve it using a pensil and paper?
|
|
|
|
|
|
Or, in the case of no-effort homework questions like this: please do not post.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
If only ... 
|
|
|
|